Re: [PATCH 3/4] time,acct: drop irq save & restore from __acct_update_integrals
From: Peter Zijlstra
Date: Mon Feb 01 2016 - 04:29:07 EST
On Sun, Jan 31, 2016 at 09:12:30PM -0500, riel@xxxxxxxxxx wrote:
> kernel/tsacct.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/kernel/tsacct.c b/kernel/tsacct.c
> index 9c23584c76c4..31fb6c9746d4 100644
> --- a/kernel/tsacct.c
> +++ b/kernel/tsacct.c
> @@ -124,20 +124,18 @@ static void __acct_update_integrals(struct task_struct *tsk,
> cputime_t utime, cputime_t stime)
> {
> cputime_t time, dtime;
> - unsigned long flags;
> u64 delta;
>
> if (!likely(tsk->mm))
> return;
>
> - local_irq_save(flags);
> time = stime + utime;
> dtime = time - tsk->acct_timexpd;
> /* Avoid division: cputime_t is often in nanoseconds already. */
> delta = cputime_to_nsecs(dtime);
>
> if (delta < TICK_NSEC)
> - goto out;
> + return;
>
> tsk->acct_timexpd = time;
> /*
> @@ -147,8 +145,6 @@ static void __acct_update_integrals(struct task_struct *tsk,
> */
> tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm) >> 10;
> tsk->acct_vm_mem1 += delta * tsk->mm->total_vm >> 10;
> -out:
> - local_irq_restore(flags);
> }
Like Frederic said on your last posting, at the very least
do_exit()->acct_update_integrals() will not have IRQs disabled.
Its just the acct_account_cputime() callers that I suspect will all have
IRQs disabled, but it would still be goot to verify that with a
WARN_ON(!irqs_disabled()) test in there for at least one test run, and
then include that you did this in the Changelog.