public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@redhat.com, peterz@infradead.org
Subject: [PATCH] sched/x86: Calculate booted cores after construction of sibling_mask
Date: Thu, 31 May 2012 13:07:38 +0530	[thread overview]
Message-ID: <20120531073738.GH7511@linux.vnet.ibm.com> (raw)

While booting tip (1d06e6d354) on qemu with -smp sockets=1,cores=2,threads=2
topology. There is a mismatch between the number of cores actually present
and cores reported.

Changes related to calculating the number of booted cores was introduced
by 316ad248307fb (sched/x86: Rewrite set_cpu_sibling_map()). With the
clean up, the calculation of booted cores per package is done on an
incompletely constructed sibling_mask per cpu.

sched/x86: Calculate booted cores after construction of sibling_mask

This patch re-introduces the old behaviour of constructing the complete
sibling mask of the cpu, before calculating the number of cores booted.

On qemu booted with -smp sockets=1,cores=2,threads=2,
Before:
$ cat /proc/cpuinfo |grep cores
cpu cores       : 2
cpu cores       : 1
cpu cores       : 4
cpu cores       : 3

With the patch:
$ cat /proc/cpuinfo |grep cores
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
---
 arch/x86/kernel/smpboot.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index fd019d7..a8d78f3 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -382,7 +382,12 @@ void __cpuinit set_cpu_sibling_map(int cpu)
 		if ((i == cpu) || (has_mc && match_llc(c, o)))
 			link_mask(llc_shared, cpu, i);

-		if ((i == cpu) || (has_mc && match_mc(c, o))) {
+	}
+
+	for_each_cpu(i, cpu_sibling_setup_mask) {
+		o = &cpu_data(i);
+
+	if ((i == cpu) || (has_mc && match_mc(c, o))) {
 			link_mask(core, cpu, i);

 			/*


             reply	other threads:[~2012-05-31  7:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31  7:37 Kamalesh Babulal [this message]
2012-05-31 20:30 ` [PATCH] sched/x86: Calculate booted cores after construction of sibling_mask Peter Zijlstra
2012-06-01  6:48   ` Kamalesh Babulal
2012-06-01 10:08     ` Peter Zijlstra
2012-06-06 15:52 ` [tip:sched/urgent] " tip-bot for Kamalesh Babulal

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=20120531073738.GH7511@linux.vnet.ibm.com \
    --to=kamalesh@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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