All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Petr Holasek <pholasek@redhat.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 7/7] perf bench numa: Fix immediate meeting of convergence condition
Date: Mon, 27 Apr 2015 14:04:09 -0300	[thread overview]
Message-ID: <1430154249-28268-8-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1430154249-28268-1-git-send-email-acme@kernel.org>

From: Petr Holasek <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>
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>
---
 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 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);
 	}
-- 
1.9.3


  parent reply	other threads:[~2015-04-27 17:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 17:04 [GIT PULL 0/7] perf/urgent fixes Arnaldo Carvalho de Melo
2015-04-27 17:04 ` [PATCH 1/7] perf kmem: Fix compiles on RHEL6/OL6 Arnaldo Carvalho de Melo
2015-04-27 17:04 ` [PATCH 2/7] tools lib traceevent: Fix build failure on 32-bit arch Arnaldo Carvalho de Melo
2015-04-27 17:04 ` [PATCH 3/7] perf top: Fix a segfault when kernel map is restricted Arnaldo Carvalho de Melo
2015-04-27 17:04 ` [PATCH 4/7] perf probe: Fix bug with global variables handling Arnaldo Carvalho de Melo
2015-04-27 17:04 ` [PATCH 5/7] perf bench futex: Fix hung wakeup tasks after requeueing Arnaldo Carvalho de Melo
2015-04-27 17:04 ` [PATCH 6/7] perf bench numa: Fixes of --quiet argument Arnaldo Carvalho de Melo
2015-04-27 17:04 ` Arnaldo Carvalho de Melo [this message]
2015-05-01  6:32 ` [GIT PULL 0/7] perf/urgent fixes Ingo Molnar

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=1430154249-28268-8-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pholasek@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.