lkml.org 
[lkml]   [2015]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] sched, timer: Use atomics for thread_group_cputimer to improve scalability
On Wed, Apr 15, 2015 at 03:25:36PM +0200, Frederic Weisbecker wrote:
> On Tue, Apr 14, 2015 at 04:09:45PM -0700, Jason Low wrote:
> > void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times)
> > {
> > struct thread_group_cputimer *cputimer = &tsk->signal->cputimer;
> > struct task_cputime sum;
> >
> > if (!cputimer->running) {
> > /*
> > * The POSIX timer interface allows for absolute time expiry
> > * values through the TIMER_ABSTIME flag, therefore we have
> > + * to synchronize the timer to the clock every time we start it.
> > */
> > thread_group_cputime(tsk, &sum);
> > + update_gt_cputime(cputimer, &sum);
> > + /* Start 'running' after update_gt_cputime() */
> > + smp_store_release(&cputimer->running, 1);
>
> This barrier should be mirrored somewhere but I can't see where in this patch.
> Maybe in another one in the series. Or maybe there is already a barrier in the
> existing code that I'm missing. I would expect to see it in account_group_*_time().
> In any case, there should be comment about what it mirrors.

I think it should be in cputimer_running(), which should use
smp_load_acquire() to read cputimer->running.

That way you guarantee that everything observing 'running' will indeed
observe the initialized state.




\
 
 \ /
  Last update: 2015-04-15 16:01    [W:0.128 / U:1.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site