On 2016-10-17 18:09:49 [-0700], Davidlohr Bueso wrote:
> On Sun, 16 Oct 2016, Sebastian Andrzej Siewior wrote:
> > It popped up in perf testing that the worker consumes some amount of
> > CPU. It boils down to the increment of `ops` which causes cache line
> > bouncing between the individual threads.
> Are you referring to this?
>       │         for (i = 0; i < nfutexes; i++, w->ops++) {
>       │ be:   add    $0x1,%ebx
> 65.87 │       addq   $0x1,0x18(%r12)
> (which is like 65% of 13% on my box with a default futex-hash run).

> Even better, could we get rid entirely of the ops increments and just
> use a local variable, then update the worker at the end of the function.
> The following makes 'perf' pretty much disappear in the profile.

this should do it, too. So what remains is the read access for w->futex
but since it does not pop up in perf, it is probably not that important.

> Thanks,
> Davidlohr


Reply via email to