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.
This commit is contained in:
Abhinandan Lahori 2024-11-08 08:00:17 +05:30 committed by GitHub
parent 906bd684e4
commit 4cd3b6f0a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -154,10 +154,10 @@ void acct_update_integrals(struct task_struct *tsk)
u64 utime, stime; u64 utime, stime;
unsigned long flags; unsigned long flags;
local_irq_save(flags); spin_lock_irqsave(&tsk->mm->page_table_lock, flags);
task_cputime(tsk, &utime, &stime); task_cputime(tsk, &utime, &stime);
__acct_update_integrals(tsk, utime, stime); __acct_update_integrals(tsk, utime, stime);
local_irq_restore(flags); spin_unlock_irqrestore(&tsk->mm->page_table_lock, flags);
} }
/** /**