lkml.org 
[lkml]   [2009]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] posix-cpu-timers: optimize calling thread_group_cputime()
On Fri, 12 Jun 2009 13:09:46 +0200
Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> 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?
Actually I did not any benchmarking yet, so I don't know what is the real
impact of the patch. I hope it make things taster but the result can be
opposite from my expectations.

> 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.

utime, stime are probable in the same cache line, se.sum_exec_runtime is far away
from them in struct task_struct so it's in rather separate cache line.

Stanislaw


\
 
 \ /
  Last update: 2009-06-12 13:29    [W:0.063 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site