Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1504256

Re: [PATCH] perf/bench-futex: Avoid worker cacheline bouncing

From Davidlohr Bueso <dave@stgolabs.net>
Newsgroups linux.kernel
Subject Re: [PATCH] perf/bench-futex: Avoid worker cacheline bouncing
Date 2016-10-19 20:50 +0200
Message-ID <su466-57u-31@gated-at.bofh.it> (permalink)
References <ssYYN-1qy-13@gated-at.bofh.it> <strep-3hr-5@gated-at.bofh.it> <su0ca-2v4-49@gated-at.bofh.it> <su3tn-4Ru-25@gated-at.bofh.it> <su3D4-4Wo-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@linutronix.de>
>Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] perf bench futex: cache align the worer struct Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-10-16 21:10 +0200
  [PATCH 2/2] perf bench futex: add NUMA support Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-10-16 21:10 +0200
    Re: [PATCH 2/2] perf bench futex: add NUMA support Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-17 16:40 +0200
      Re: [PATCH 2/2] perf bench futex: add NUMA support Jiri Olsa <jolsa@redhat.com> - 2016-10-17 17:10 +0200
        Re: [PATCH 2/2] perf bench futex: add NUMA support Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-17 17:10 +0200
          [PATCH 2/2 v2] perf bench futex: add NUMA support Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-10-17 17:40 +0200
            Re: [PATCH 2/2 v2] perf bench futex: add NUMA support Davidlohr Bueso <dave@stgolabs.net> - 2016-10-19 20:20 +0200
              Re: [PATCH 2/2 v2] perf bench futex: add NUMA support Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-10-19 20:40 +0200
                Re: [PATCH 2/2 v2] perf bench futex: add NUMA support Davidlohr Bueso <dave@stgolabs.net> - 2016-10-21 04:40 +0200
            Re: [PATCH 2/2 v2] perf bench futex: add NUMA support Davidlohr Bueso <dave@stgolabs.net> - 2016-10-21 05:10 +0200
  Re: [PATCH 1/2] perf bench futex: cache align the worer struct Davidlohr Bueso <dave@stgolabs.net> - 2016-10-18 03:20 +0200
    Re: [PATCH 1/2] perf bench futex: cache align the worer struct Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-10-19 16:40 +0200
      [PATCH] perf/bench-futex: Avoid worker cacheline bouncing Davidlohr Bueso <dave@stgolabs.net> - 2016-10-19 20:10 +0200
        Re: [PATCH] perf/bench-futex: Avoid worker cacheline bouncing Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-10-19 20:20 +0200
          Re: [PATCH] perf/bench-futex: Avoid worker cacheline bouncing Davidlohr Bueso <dave@stgolabs.net> - 2016-10-19 20:50 +0200
  [tip:perf/core] perf bench futex: Cache align the worker struct tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-10-24 21:10 +0200

csiph-web