public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Oleg Nesterov <oleg@redhat.com>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [RFC PATCH] posix-cpu-timers: optimize calling thread_group_cputime()
Date: Fri, 12 Jun 2009 13:09:46 +0200	[thread overview]
Message-ID: <1244804986.6691.1224.camel@laptop> (raw)
In-Reply-To: <20090612123903.37cfd868@dhcp-lab-109.englab.brq.redhat.com>

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.


  reply	other threads:[~2009-06-12 11:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12 10:39 [RFC PATCH] posix-cpu-timers: optimize calling thread_group_cputime() Stanislaw Gruszka
2009-06-12 11:09 ` Peter Zijlstra [this message]
2009-06-12 11:20   ` Stanislaw Gruszka
2009-06-12 14:25     ` Oleg Nesterov
2009-06-15  8:55       ` Stanislaw Gruszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244804986.6691.1224.camel@laptop \
    --to=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=sgruszka@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox