mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Petr Holasek <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jolsa@redhat.com, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, hpa@zytor.com, acme@redhat.com,
	mingo@kernel.org, pholasek@redhat.com
Subject: [tip:perf/urgent] perf bench numa: Fix immediate meeting of convergence condition
Date: Fri, 1 May 2015 03:16:01 -0700	[thread overview]
Message-ID: <tip-1d90a685eb75a56648d7dd22c704a1a6da516de9@git.kernel.org> (raw)
In-Reply-To: <1429198699-25039-4-git-send-email-pholasek@redhat.com>

Commit-ID:  1d90a685eb75a56648d7dd22c704a1a6da516de9
Gitweb:     http://git.kernel.org/tip/1d90a685eb75a56648d7dd22c704a1a6da516de9
Author:     Petr Holasek <pholasek@redhat.com>
AuthorDate: Thu, 16 Apr 2015 17:38:19 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 27 Apr 2015 13:57:50 -0300

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>
---
 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 cd872e9c..ba5efa4 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);
 	}

  reply	other threads:[~2015-05-01 10:16 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 ` [PATCH 3/3] perf bench numa: fix immediate meeting of convergence condition Petr Holasek
2015-05-01 10:16   ` tip-bot for Petr Holasek [this message]
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=tip-1d90a685eb75a56648d7dd22c704a1a6da516de9@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pholasek@redhat.com \
    --cc=tglx@linutronix.de \
    /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