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]
Message-ID: <20161019184132.GC28074@linux-80c1.suse>
Date:   Wed, 19 Oct 2016 11:41:32 -0700
From:   Davidlohr Bueso <dave@...olabs.net>
To:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
        Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH] perf/bench-futex: Avoid worker cacheline bouncing

On Wed, 19 Oct 2016, Sebastian Andrzej Siewior wrote:

>On 2016-10-19 10:59:33 [-0700], Davidlohr Bueso wrote:
>> Sebastian noted that overhead for worker thread ops (throughput)
>> accounting was producing 'perf' to appear in the profiles, consuming
>> a non-trivial (ie 13%) amount of CPU. This is due to cacheline
>> bouncing due to the increment of w->ops. We can easily fix this by
>> just working on a local copy and updating the actual worker once
>> done running, and ready to show the program summary. There is no
>> danger of the worker being concurrent, so we can trust that no stale
>> value is being seen by another thread.
>>
>> Reported-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
>Acked-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>

Thanks.

>
>> --- a/tools/perf/bench/futex-hash.c
>> +++ b/tools/perf/bench/futex-hash.c
>> @@ -63,8 +63,9 @@ static const char * const bench_futex_hash_usage[] = {
>> static void *workerfn(void *arg)
>> {
>> 	int ret;
>> -	unsigned int i;
>> 	struct worker *w = (struct worker *) arg;
>> +	unsigned int i;
>> +	unsigned long ops = w->ops; /* avoid cacheline bouncing */
>
>we start at 0 so there is probably no need to init it with w->ops.

Yeah, but I prefer having it this way - separates the init from the actual
work (although no big deal here). The extra load happens ncpu times, so
also no big deal.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ