lkml.org 
[lkml]   [2015]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] sched, timer: Use atomics for thread_group_cputimer to improve scalability
From
Date
On Mon, 2015-03-02 at 13:44 -0800, Linus Torvalds wrote:
> On Mon, Mar 2, 2015 at 1:16 PM, Jason Low <jason.low2@hp.com> wrote:
> >
> > In original code, we set cputimer->running first so it is running while
> > we call update_gt_cputime(). Now in this patch, we swapped the 2 calls
> > such that we set running after calling update_gt_cputime(), so that
> > wouldn't be an issue anymore.
>
> Hmm. If you actually care about ordering, and 'running' should be
> written to after the other things, then it might be best if you use
>
> smp_store_release(&cputimer->running, 1);
>
> which makes it clear that the store happens *after* what went before it.
>
> Or at least have a "smp_wmb()" between the atomic64 updates and the
> "WRITE_ONCE()".
>
> I guess that since you use cmpxchg in update_gt_cputime, the accesses
> end up being ordered anyway, but it might be better to make that thing
> very explicit.

Yeah, I suppose the extra (smp_mb or smp_wmb) might add more overhead
but since this is not a common code path anyway, it would be worth
adding it to make things more clear.



\
 
 \ /
  Last update: 2015-03-03 00:01    [W:0.095 / U:0.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site