summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPetr Holasek <pholasek@redhat.com>2015-04-16 17:38:19 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-04-27 18:57:50 +0200
commit1d90a685eb75a56648d7dd22c704a1a6da516de9 (patch)
tree68ccf9ddc212ca9304f8f5d4fdc5997dc98debe5 /tools
parentperf bench numa: Fixes of --quiet argument (diff)
downloadlinux-1d90a685eb75a56648d7dd22c704a1a6da516de9.tar.xz
linux-1d90a685eb75a56648d7dd22c704a1a6da516de9.zip
perf bench numa: Fix immediate meeting of convergence condition
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> Reviewed-by: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/1429198699-25039-4-git-send-email-pholasek@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/bench/numa.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index cd872e9c3a9c..ba5efa4710b5 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -828,6 +828,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;
}
@@ -882,6 +885,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);
}