lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 05 Mar 2015 12:02:49 -0800
From:	Jason Low <jason.low2@...com>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Oleg Nesterov <oleg@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...nel.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Mike Galbraith <umgwanakikbuti@...il.com>,
	Rik van Riel <riel@...hat.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Scott Norton <scott.norton@...com>,
	Aswin Chandramouleeswaran <aswin@...com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	jason.low2@...com
Subject: Re: [PATCH v2] sched, timer: Use atomics for thread_group_cputimer
 to improve scalability

On Thu, 2015-03-05 at 16:20 +0100, Frederic Weisbecker wrote:
> On Mon, Mar 02, 2015 at 01:44:04PM -0800, Linus Torvalds wrote:
> > On Mon, Mar 2, 2015 at 1:16 PM, Jason Low <jason.low2@...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()".
> 
> FWIW, perhaps it can be reduced with an smp_mb__before_atomic() on the
> account_group_*_time() side,

Hi Frederic,

I think Linus might be referring to the updates in update_gt_cputime()?
Otherwise, if the atomic updates in account_group_*_time() is already
enough for correctness, then we might not want to be adding barriers in
the hot paths if they aren't necessary.

I was thinking about the adding smp_store_release(&cputimer->running, 1)
to document that we want to write to the running field after the
operations in update_gt_cputime(). The overhead here won't be much since
it doesn't get called frequently as you mentioned.

>  paired with smp_wmb() from the thread_group_cputimer()
> side. Arming cputime->running shouldn't be too frequent while update cputime
> happens at least every tick...
> 
> Assuming smp_mb__before_atomic() is more lightweight than smp_load_acquire()
> of course. 
> 
> > 
> > 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.
> > 
> >                    Linus


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

Powered by Openwall GNU/*/Linux Powered by OpenVZ