From: Petr Holasek <pholasek@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Petr Holasek <pholasek@redhat.com>
Subject: [PATCH 3/3] perf bench numa: fix immediate meeting of convergence condition
Date: Thu, 16 Apr 2015 17:38:19 +0200 [thread overview]
Message-ID: <1429198699-25039-4-git-send-email-pholasek@redhat.com> (raw)
In-Reply-To: <1429198699-25039-1-git-send-email-pholasek@redhat.com>
This patch fixes the race in the beginning of benchmark run when some
threads hasn't got assigned curr_cpu yet so they don't occur in
nodes-of-process stats and benchmark concludes that all remaining threads
are converged already.
The race can be reproduced with small amount of threads and some bigger amount
of shared process memory, e.g. one process, two threads and 5GB of process
memory.
Signed-off-by: Petr Holasek <pholasek@redhat.com>
---
tools/perf/bench/numa.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 72edc49..1704929 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -832,6 +832,9 @@ static int count_process_nodes(int process_nr)
td = g->threads + task_nr;
node = numa_node_of_cpu(td->curr_cpu);
+ if (node < 0) /* curr_cpu was likely still -1 */
+ return 0;
+
node_present[node] = 1;
}
@@ -886,6 +889,11 @@ static void calc_convergence_compression(int *strong)
for (p = 0; p < g->p.nr_proc; p++) {
unsigned int nodes = count_process_nodes(p);
+ if (!nodes) {
+ *strong = 0;
+ return;
+ }
+
nodes_min = min(nodes, nodes_min);
nodes_max = max(nodes, nodes_max);
}
--
2.1.0
next prev parent reply other threads:[~2015-04-16 15:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-16 15:38 [PATCH 0/3] a few perf numa benchmark fixes Petr Holasek
2015-04-16 15:38 ` [PATCH 1/3] perf bench numa: Fixes of --quiet argument Petr Holasek
2015-05-01 10:15 ` [tip:perf/urgent] " tip-bot for Petr Holasek
2015-04-16 15:38 ` [PATCH 2/3] perf bench numa: show more stats of particular threads in verbose mode Petr Holasek
2015-05-06 3:09 ` [tip:perf/core] perf bench numa: Show " tip-bot for Petr Holasek
2015-04-16 15:38 ` Petr Holasek [this message]
2015-05-01 10:16 ` [tip:perf/urgent] perf bench numa: Fix immediate meeting of convergence condition tip-bot for Petr Holasek
2015-04-16 16:13 ` [PATCH 0/3] a few perf numa benchmark fixes Ingo Molnar
2015-04-27 16:44 ` Arnaldo Carvalho de Melo
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=1429198699-25039-4-git-send-email-pholasek@redhat.com \
--to=pholasek@redhat.com \
--cc=acme@redhat.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
all inboxes | Powered by JetHome®