From: Davidlohr Bueso <dave@stgolabs.net>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@redhat.com>, Jiri Olsa <jolsa@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH 2/2 v2] perf bench futex: add NUMA support
Date: Thu, 20 Oct 2016 20:03:06 -0700 [thread overview]
Message-ID: <20161021030306.GD30561@linux-80c1.suse> (raw)
In-Reply-To: <20161017153331.pkzaij5a3ma5c5s5@linutronix.de>
On Mon, 17 Oct 2016, Sebastian Andrzej Siewior wrote:
>+#ifdef HAVE_LIBNUMA_SUPPORT
>+#include <numa.h>
>+#endif
In futex.h
>+static int numa_node = -1;
In futex.h (perhaps rename to futexbench_numa_node?)
>+#ifndef HAVE_LIBNUMA_SUPPORT
>+static int numa_run_on_node(int node __maybe_unused) { return 0; }
>+static int numa_node_of_cpu(int node __maybe_unused) { return 0; }
>+static void *numa_alloc_local(size_t size) { return malloc(size); }
>+static void numa_free(void *p, size_t size __maybe_unused) { return free(p); }
>+#endif
>+
>+static bool cpu_is_local(int cpu)
>+{
>+ if (numa_node < 0)
>+ return true;
>+ if (numa_node_of_cpu(cpu) == numa_node)
>+ return true;
>+ return false;
>+}
In futex.h
>- if (!nthreads) /* default to the number of CPUs */
>- nthreads = ncpus;
>+ if (!nthreads) {
>+ /* default to the number of CPUs per NUMA node */
This comment should go...
>+ if (numa_node < 0) {
>+ nthreads = ncpus;
>+ } else {
here.
>+ for (i = 0; i < ncpus; i++) {
>+ if (cpu_is_local(i))
>+ nthreads++;
>+ }
>+ if (!nthreads)
>+ err(EXIT_FAILURE, "No online CPUs for this node");
>+ }
>+ } else {
>+ int cpu_available = 0;
>
>- worker = calloc(nthreads, sizeof(*worker));
>+ for (i = 0; i < ncpus && !cpu_available; i++) {
>+ if (cpu_is_local(i))
>+ cpu_available = 1;
>+ }
Is this really necessary? If the user passes the number of threads, then we shouldn't
care about ncpus; we just run all the threads on the specified node. Wouldn't the
below numa_run_on_node() ensure that the node is not, for example, CPU-less?
>+ if (!cpu_available)
>+ err(EXIT_FAILURE, "No online CPUs for this node");
>+ }
>+
>+ if (numa_node >= 0) {
>+ ret = numa_run_on_node(numa_node);
>+ if (ret < 0)
>+ err(EXIT_FAILURE, "numa_run_on_node");
Thanks,
Davidlohr
next prev parent reply other threads:[~2016-10-21 3:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-16 19:08 [PATCH 1/2] perf bench futex: cache align the worer struct Sebastian Andrzej Siewior
2016-10-16 19:08 ` [PATCH 2/2] perf bench futex: add NUMA support Sebastian Andrzej Siewior
2016-10-17 14:38 ` Arnaldo Carvalho de Melo
2016-10-17 15:01 ` Jiri Olsa
2016-10-17 15:04 ` Arnaldo Carvalho de Melo
2016-10-17 15:33 ` [PATCH 2/2 v2] " Sebastian Andrzej Siewior
2016-10-19 18:16 ` Davidlohr Bueso
2016-10-19 18:37 ` Sebastian Andrzej Siewior
2016-10-21 2:34 ` Davidlohr Bueso
2016-10-21 3:03 ` Davidlohr Bueso [this message]
2016-10-18 1:09 ` [PATCH 1/2] perf bench futex: cache align the worer struct Davidlohr Bueso
2016-10-19 13:07 ` Sebastian Andrzej Siewior
2016-10-19 17:59 ` [PATCH] perf/bench-futex: Avoid worker cacheline bouncing Davidlohr Bueso
2016-10-19 18:13 ` Sebastian Andrzej Siewior
2016-10-19 18:41 ` Davidlohr Bueso
2016-10-24 19:06 ` [tip:perf/core] perf bench futex: Cache align the worker struct tip-bot for Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161021030306.GD30561@linux-80c1.suse \
--to=dave@stgolabs.net \
--cc=acme@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=dbueso@suse.de \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome