Re: [PATCH] cpuacct: add a branch prediction

From: KAMEZAWA Hiroyuki
Date: Thu Feb 26 2009 - 03:10:07 EST


On Thu, 26 Feb 2009 15:40:15 +0800
Li Zefan <lizf@xxxxxxxxxxxxxx> wrote:

> cpuacct_charge() is in fast-path, and checking of !cpuacct_susys.active
> always returns false after cpuacct has been initialized at system boot.
>
> Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
> ---
> kernel/sched.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 410eec4..fd2f7fc 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -9589,7 +9589,7 @@ static void cpuacct_charge(struct task_struct *tsk, u64 cputime)
> struct cpuacct *ca;
> int cpu;
>
> - if (!cpuacct_subsys.active)
> + if (unlikely(!cpuacct_subsys.active))
> return;
>
(Just curious)
I wonder "ca = task_ca(tsk)" will return NULL if cpuacct subsys is not initalized.
Then, can we just remove this check ?


Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/