Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753906AbbEAKQS (ORCPT ); Fri, 1 May 2015 06:16:18 -0400 Received: from terminus.zytor.com ([198.137.202.10]:52062 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753350AbbEAKQM (ORCPT ); Fri, 1 May 2015 06:16:12 -0400 Date: Fri, 1 May 2015 03:16:01 -0700 From: tip-bot for Petr Holasek Message-ID: Cc: jolsa@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, acme@redhat.com, mingo@kernel.org, pholasek@redhat.com Reply-To: pholasek@redhat.com, acme@redhat.com, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, jolsa@redhat.com, tglx@linutronix.de In-Reply-To: <1429198699-25039-4-git-send-email-pholasek@redhat.com> References: <1429198699-25039-4-git-send-email-pholasek@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf bench numa: Fix immediate meeting of convergence condition Git-Commit-ID: 1d90a685eb75a56648d7dd22c704a1a6da516de9 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2067 Lines: 58 Commit-ID: 1d90a685eb75a56648d7dd22c704a1a6da516de9 Gitweb: http://git.kernel.org/tip/1d90a685eb75a56648d7dd22c704a1a6da516de9 Author: Petr Holasek AuthorDate: Thu, 16 Apr 2015 17:38:19 +0200 Committer: Arnaldo Carvalho de Melo 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 Reviewed-by: Ingo Molnar Cc: Jiri Olsa Link: http://lkml.kernel.org/r/1429198699-25039-4-git-send-email-pholasek@redhat.com Signed-off-by: Arnaldo Carvalho de Melo --- 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); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/