public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jin Dongming <jin.dongming@np.css.fujitsu.com>
To: tglx@linutronix.de
Cc: mingo@redhat.com, hpa@zytor.com, rusty@rustcorp.com.au,
	linux-kernel@vger.kernel.org
Subject: [PATCH-next]Fix wrong local_cpulist displayed
Date: Thu, 24 Dec 2009 17:59:40 +0900	[thread overview]
Message-ID: <4B332D7C.7050704@np.css.fujitsu.com> (raw)

On my machine(Not NUMA), when the CONFIG_NUMA is selected, the value of
local_cpulist is displayed wrong. Because the value of numa_node is -1, so the
wrong address will be returned and the wrong value of local_cpulist is
displayed.

The example on my machine is as following:
Before my patch
        #cd /sys/device/pci0000:00/0000:00:1c.0
        #cat cpulist
                /* nothing */

After my pache
        #cd /sys/device/pci0000:00/0000:00:1c.0
        #cat cpulist
         0-1

I confirmed this patch fixes the above problem.

Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
---
 arch/x86/include/asm/topology.h |    2 +-
 arch/x86/mm/numa.c              |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index c5087d7..c63921a 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -99,7 +99,7 @@ extern const struct cpumask *cpumask_of_node(int node);
 /* Returns a pointer to the cpumask of CPUs on Node 'node'. */
 static inline const struct cpumask *cpumask_of_node(int node)
 {
-	return node_to_cpumask_map[node];
+	return node == -1 ? cpu_online_mask : node_to_cpumask_map[node];
 }
 #endif
 
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 550df48..e57a7f5 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -47,6 +47,9 @@ void __init setup_node_to_cpumask_map(void)
  */
 const struct cpumask *cpumask_of_node(int node)
 {
+	if (node == -1)
+		return cpu_online_mask;
+
 	if (node >= nr_node_ids) {
 		printk(KERN_WARNING
 			"cpumask_of_node(%d): node > nr_node_ids(%d)\n",
-- 
1.6.4


                 reply	other threads:[~2009-12-24  8:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4B332D7C.7050704@np.css.fujitsu.com \
    --to=jin.dongming@np.css.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --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