[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1244804986.6691.1224.camel@laptop>
Date: Fri, 12 Jun 2009 13:09:46 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Stanislaw Gruszka <sgruszka@...hat.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Oleg Nesterov <oleg@...hat.com>, Ingo Molnar <mingo@...e.hu>
Subject: Re: [RFC PATCH] posix-cpu-timers: optimize calling
thread_group_cputime()
On Fri, 2009-06-12 at 12:39 +0200, Stanislaw Gruszka wrote:
> - times->utime = cputime_add(times->utime, t->utime);
> - times->stime = cputime_add(times->stime, t->stime);
> - times->sum_exec_runtime += t->se.sum_exec_runtime;
> + if (mask & TG_CPUCLOCK_UTIME)
> + times->utime = cputime_add(times->utime, t->utime);
> + if (mask & TG_CPUCLOCK_STIME)
> + times->stime = cputime_add(times->stime, t->stime);
> + if (mask & TG_CPUCLOCK_SCHED)
> + times->sum_exec_runtime += t->se.sum_exec_runtime;
Does adding 3 branches really make it faster? Since you're bound to want
at least one, I would expect the cacheline to be hot (assuming all three
variables live in the same cacheline -- if not, they should be!), so all
you're avoiding is the addition.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists