public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Inverted NUMA test in setup_pcpu_remap()?
@ 2009-04-01  5:31 David Miller
  2009-04-01  5:56 ` Yinghai Lu
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2009-04-01  5:31 UTC (permalink / raw)
  To: tj; +Cc: linux-kernel


The test currently is:

	if (!cpu_has_pse || pcpu_need_numa())
		return -EINVAL;

Don't we really mean "!pcpu_need_numa()"?

The way I read the intent, setup_pcpu_remap() should be used in the
NUMA case.  But that's not what's happening because of how this test
is coded.

In fact, the test here is identical to the one used in
setup_pcpu_embed()

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Inverted NUMA test in setup_pcpu_remap()?
  2009-04-01  5:31 Inverted NUMA test in setup_pcpu_remap()? David Miller
@ 2009-04-01  5:56 ` Yinghai Lu
  2009-04-01  6:06   ` [PATCH] x86,percpu: fix inverted NUMA test in setup_pcpu_remap() Tejun Heo
  0 siblings, 1 reply; 8+ messages in thread
From: Yinghai Lu @ 2009-04-01  5:56 UTC (permalink / raw)
  To: David Miller, Ingo Molnar, H. Peter Anvin, Thomas Gleixner
  Cc: tj, linux-kernel

On Tue, Mar 31, 2009 at 10:31 PM, David Miller <davem@davemloft.net> wrote:
>
> The test currently is:
>
>        if (!cpu_has_pse || pcpu_need_numa())
>                return -EINVAL;
>
> Don't we really mean "!pcpu_need_numa()"?
>
> The way I read the intent, setup_pcpu_remap() should be used in the
> NUMA case.  But that's not what's happening because of how this test
> is coded.
>
> In fact, the test here is identical to the one used in
> setup_pcpu_embed()
> --

you are right. on one 4 sockets system got

[    0.000000] PERCPU: Allocated 471 4k pages, static data 1925472 bytes

that is from setup_pcpu_4k...

YH

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] x86,percpu: fix inverted NUMA test in setup_pcpu_remap()
  2009-04-01  5:56 ` Yinghai Lu
@ 2009-04-01  6:06   ` Tejun Heo
  2009-04-01  7:27     ` [PATCH] x86: remove duplicated code with pcpu_need_numa() Yinghai Lu
  2009-04-02  4:09     ` [tip:x86/urgent] x86,percpu: fix inverted NUMA test in setup_pcpu_remap() Tejun Heo
  0 siblings, 2 replies; 8+ messages in thread
From: Tejun Heo @ 2009-04-01  6:06 UTC (permalink / raw)
  To: Yinghai Lu, Ingo Molnar
  Cc: David Miller, H. Peter Anvin, Thomas Gleixner, linux-kernel

setup_percpu_remap() is for NUMA machines yet it bailed out with
-EINVAL if pcpu_need_numa().  Fix the inverted condition.

This problem was reported by David Miller and verified by Yinhai Lu.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: David Miller <davem@davemloft.net>
Reported-by: Yinghai Lu <yinghai@kernel.org>
---
Oops, thanks for spotting it.  I don't have a numa machine so the
condition was never tested on actual machines.  :-)

 arch/x86/kernel/setup_percpu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 400331b..876b127 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -162,7 +162,7 @@ static ssize_t __init setup_pcpu_remap(size_t static_size)
 	 * If large page isn't supported, there's no benefit in doing
 	 * this.  Also, on non-NUMA, embedding is better.
 	 */
-	if (!cpu_has_pse || pcpu_need_numa())
+	if (!cpu_has_pse || !pcpu_need_numa())
 		return -EINVAL;
 
 	last = NULL;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] x86: remove duplicated code with pcpu_need_numa()
  2009-04-01  6:06   ` [PATCH] x86,percpu: fix inverted NUMA test in setup_pcpu_remap() Tejun Heo
@ 2009-04-01  7:27     ` Yinghai Lu
  2009-04-01  7:33       ` Tejun Heo
                         ` (2 more replies)
  2009-04-02  4:09     ` [tip:x86/urgent] x86,percpu: fix inverted NUMA test in setup_pcpu_remap() Tejun Heo
  1 sibling, 3 replies; 8+ messages in thread
From: Yinghai Lu @ 2009-04-01  7:27 UTC (permalink / raw)
  To: Tejun Heo, Ingo Molnar, H. Peter Anvin, Thomas Gleixner
  Cc: David Miller, linux-kernel


Impact: clean up

those code pcpu_need_numa(), should be removed.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/setup_percpu.c |   14 --------------
 1 file changed, 14 deletions(-)

Index: linux-2.6/arch/x86/kernel/setup_percpu.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_percpu.c
+++ linux-2.6/arch/x86/kernel/setup_percpu.c
@@ -153,7 +153,6 @@ static struct page * __init pcpur_get_pa
 static ssize_t __init setup_pcpu_remap(size_t static_size)
 {
 	static struct vm_struct vm;
-	pg_data_t *last;
 	size_t ptrs_size, dyn_size;
 	unsigned int cpu;
 	ssize_t ret;
@@ -165,19 +164,6 @@ static ssize_t __init setup_pcpu_remap(s
 	if (!cpu_has_pse || !pcpu_need_numa())
 		return -EINVAL;
 
-	last = NULL;
-	for_each_possible_cpu(cpu) {
-		int node = early_cpu_to_node(cpu);
-
-		if (node_online(node) && NODE_DATA(node) &&
-		    last && last != NODE_DATA(node))
-			goto proceed;
-
-		last = NODE_DATA(node);
-	}
-	return -EINVAL;
-
-proceed:
 	/*
 	 * Currently supports only single page.  Supporting multiple
 	 * pages won't be too difficult if it ever becomes necessary.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86: remove duplicated code with pcpu_need_numa()
  2009-04-01  7:27     ` [PATCH] x86: remove duplicated code with pcpu_need_numa() Yinghai Lu
@ 2009-04-01  7:33       ` Tejun Heo
  2009-04-01  8:04       ` David Miller
  2009-04-02  4:09       ` [tip:x86/urgent] " Yinghai Lu
  2 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2009-04-01  7:33 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, H. Peter Anvin, Thomas Gleixner, David Miller,
	linux-kernel

Yinghai Lu wrote:
> Impact: clean up
> 
> those code pcpu_need_numa(), should be removed.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.  Heh... that was a mess.

-- 
tejun

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86: remove duplicated code with pcpu_need_numa()
  2009-04-01  7:27     ` [PATCH] x86: remove duplicated code with pcpu_need_numa() Yinghai Lu
  2009-04-01  7:33       ` Tejun Heo
@ 2009-04-01  8:04       ` David Miller
  2009-04-02  4:09       ` [tip:x86/urgent] " Yinghai Lu
  2 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2009-04-01  8:04 UTC (permalink / raw)
  To: yinghai; +Cc: tj, mingo, hpa, tglx, linux-kernel

From: Yinghai Lu <yinghai@kernel.org>
Date: Wed, 01 Apr 2009 00:27:44 -0700

> 
> Impact: clean up
> 
> those code pcpu_need_numa(), should be removed.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [tip:x86/urgent] x86,percpu: fix inverted NUMA test in setup_pcpu_remap()
  2009-04-01  6:06   ` [PATCH] x86,percpu: fix inverted NUMA test in setup_pcpu_remap() Tejun Heo
  2009-04-01  7:27     ` [PATCH] x86: remove duplicated code with pcpu_need_numa() Yinghai Lu
@ 2009-04-02  4:09     ` Tejun Heo
  1 sibling, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2009-04-02  4:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, davem, tj, tglx, mingo

Commit-ID:  eb12ce60c81826a99eadbc56401e08ceb37a0cc2
Gitweb:     http://git.kernel.org/tip/eb12ce60c81826a99eadbc56401e08ceb37a0cc2
Author:     Tejun Heo <tj@kernel.org>
AuthorDate: Wed, 1 Apr 2009 15:06:33 +0900
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 2 Apr 2009 06:08:05 +0200

x86,percpu: fix inverted NUMA test in setup_pcpu_remap()

setup_percpu_remap() is for NUMA machines yet it bailed out with
-EINVAL if pcpu_need_numa().  Fix the inverted condition.

This problem was reported by David Miller and verified by Yinhai Lu.

Reported-by: David Miller <davem@davemloft.net>
Reported-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
LKML-Reference: <49D30469.8020006@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/setup_percpu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 400331b..876b127 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -162,7 +162,7 @@ static ssize_t __init setup_pcpu_remap(size_t static_size)
 	 * If large page isn't supported, there's no benefit in doing
 	 * this.  Also, on non-NUMA, embedding is better.
 	 */
-	if (!cpu_has_pse || pcpu_need_numa())
+	if (!cpu_has_pse || !pcpu_need_numa())
 		return -EINVAL;
 
 	last = NULL;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [tip:x86/urgent] x86: remove duplicated code with pcpu_need_numa()
  2009-04-01  7:27     ` [PATCH] x86: remove duplicated code with pcpu_need_numa() Yinghai Lu
  2009-04-01  7:33       ` Tejun Heo
  2009-04-01  8:04       ` David Miller
@ 2009-04-02  4:09       ` Yinghai Lu
  2 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2009-04-02  4:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, davem, tj, tglx, mingo

Commit-ID:  3de46fda4c104deef17ec70f85361f5c6b84ce0e
Gitweb:     http://git.kernel.org/tip/3de46fda4c104deef17ec70f85361f5c6b84ce0e
Author:     Yinghai Lu <yinghai@kernel.org>
AuthorDate: Wed, 1 Apr 2009 00:27:44 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 2 Apr 2009 06:08:05 +0200

x86: remove duplicated code with pcpu_need_numa()

Impact: clean up

those code pcpu_need_numa(), should be removed.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: David Miller <davem@davemloft.net>
LKML-Reference: <49D31770.9090502@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/setup_percpu.c |   14 --------------
 1 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 876b127..3a97a4c 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -153,7 +153,6 @@ static struct page * __init pcpur_get_page(unsigned int cpu, int pageno)
 static ssize_t __init setup_pcpu_remap(size_t static_size)
 {
 	static struct vm_struct vm;
-	pg_data_t *last;
 	size_t ptrs_size, dyn_size;
 	unsigned int cpu;
 	ssize_t ret;
@@ -165,19 +164,6 @@ static ssize_t __init setup_pcpu_remap(size_t static_size)
 	if (!cpu_has_pse || !pcpu_need_numa())
 		return -EINVAL;
 
-	last = NULL;
-	for_each_possible_cpu(cpu) {
-		int node = early_cpu_to_node(cpu);
-
-		if (node_online(node) && NODE_DATA(node) &&
-		    last && last != NODE_DATA(node))
-			goto proceed;
-
-		last = NODE_DATA(node);
-	}
-	return -EINVAL;
-
-proceed:
 	/*
 	 * Currently supports only single page.  Supporting multiple
 	 * pages won't be too difficult if it ever becomes necessary.

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-04-02  4:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-01  5:31 Inverted NUMA test in setup_pcpu_remap()? David Miller
2009-04-01  5:56 ` Yinghai Lu
2009-04-01  6:06   ` [PATCH] x86,percpu: fix inverted NUMA test in setup_pcpu_remap() Tejun Heo
2009-04-01  7:27     ` [PATCH] x86: remove duplicated code with pcpu_need_numa() Yinghai Lu
2009-04-01  7:33       ` Tejun Heo
2009-04-01  8:04       ` David Miller
2009-04-02  4:09       ` [tip:x86/urgent] " Yinghai Lu
2009-04-02  4:09     ` [tip:x86/urgent] x86,percpu: fix inverted NUMA test in setup_pcpu_remap() Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox