From 4cd3b6f0a603b92c06f1cade6329188c3cd0ade4 Mon Sep 17 00:00:00 2001 From: Abhinandan Lahori Date: Fri, 8 Nov 2024 08:00:17 +0530 Subject: [PATCH] Update tsacct.c Optimize acct_update_integrals by replacing local_irq_save with a more fine-grained spinlock (tsk->mm->page_table_lock) to reduce locking overhead. This minimizes the time interrupts are disabled while still ensuring the integrity of the accounting data. --- kernel/tsacct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/tsacct.c b/kernel/tsacct.c index 16b283f9d831..0aaeb9bbe62e 100644 --- a/kernel/tsacct.c +++ b/kernel/tsacct.c @@ -154,10 +154,10 @@ void acct_update_integrals(struct task_struct *tsk) u64 utime, stime; unsigned long flags; - local_irq_save(flags); + spin_lock_irqsave(&tsk->mm->page_table_lock, flags); task_cputime(tsk, &utime, &stime); __acct_update_integrals(tsk, utime, stime); - local_irq_restore(flags); + spin_unlock_irqrestore(&tsk->mm->page_table_lock, flags); } /**