2004-03-03 16:57:49

by Jes Sorensen

[permalink] [raw]
Subject: [patch] 2.6.4-rc1-mm2 page_alloc on NUMA

Hi Andrew,

I need the following to compile page_alloc.c on a NUMA box. I can't say
if it's a perfect patch though as I am seeing other strange things with
.4-rc1-mm2 but this at least got it compiled and booted.

Problem is that a cpumask_t can be an array so just doing
if (cpumask_t) doesn't work.

Cheers,
Jes

--- linux-2.6.4-rc1-mm2/mm/page_alloc.c~ Wed Mar 3 06:47:37 2004
+++ linux-2.6.4-rc1-mm2/mm/page_alloc.c Wed Mar 3 07:55:29 2004
@@ -1166,7 +1166,7 @@
val = node_distance(node, n);

/* Give preference to headless and unused nodes */
- if (node_to_cpumask(n))
+ if (!cpus_empty(node_to_cpumask(n)))
val += PENALTY_FOR_NODE_WITH_CPUS;

/* Slight preference for less loaded node */


2004-03-06 01:23:43

by john stultz

[permalink] [raw]
Subject: Re: [patch] 2.6.4-rc1-mm2 page_alloc on NUMA

On Wed, 2004-03-03 at 08:57, Jes Sorensen wrote:
> Hi Andrew,
>
> I need the following to compile page_alloc.c on a NUMA box. I can't say
> if it's a perfect patch though as I am seeing other strange things with
> .4-rc1-mm2 but this at least got it compiled and booted.
>
> Problem is that a cpumask_t can be an array so just doing
> if (cpumask_t) doesn't work.

With 2.6.4-rc1-mm2, I'm still seeing compile errors in page_alloc even
with this patch. Looks like the numa-aware-zonelist-builder patch isn't
defining PENALTY_FOR_NODE_WITH_CPUS properly.

mm/page_alloc.c: In function `find_next_best_node':
mm/page_alloc.c:1170: `PENALTY_FOR_NODE_WITH_CPUS' undeclared (first use
in this function)
mm/page_alloc.c:1170: (Each undeclared identifier is reported only once
mm/page_alloc.c:1170: for each function it appears in.)


.config attached

thanks
-john



Attachments:
2.6.4-rc1-mm2.config (21.22 kB)

2004-03-06 01:44:38

by Andrew Morton

[permalink] [raw]
Subject: Re: [patch] 2.6.4-rc1-mm2 page_alloc on NUMA

john stultz <[email protected]> wrote:
>
> With 2.6.4-rc1-mm2, I'm still seeing compile errors in page_alloc even
> with this patch. Looks like the numa-aware-zonelist-builder patch isn't
> defining PENALTY_FOR_NODE_WITH_CPUS properly.

Yup. I'll be fixing it thusly:



- Move the default definition of node_distance() and
PENALTY_FOR_NODE_WITH_CPUS up a level into linux/topology.h. This probably
fixes ia64 CONFIG_NUMA builds.

- Make node_distance() a macro, since we're testing for its presence with
#ifdef.



---

include/asm-generic/topology.h | 7 -------
include/asm-i386/topology.h | 5 +----
include/linux/topology.h | 7 +++++++
3 files changed, 8 insertions(+), 11 deletions(-)

diff -puN include/asm-generic/topology.h~numa-aware-zonelist-builder-fix-2 include/asm-generic/topology.h
--- 25/include/asm-generic/topology.h~numa-aware-zonelist-builder-fix-2 2004-03-03 23:40:22.000000000 -0800
+++ 25-akpm/include/asm-generic/topology.h 2004-03-03 23:40:42.000000000 -0800
@@ -45,13 +45,6 @@
#define pcibus_to_cpumask(bus) (cpu_online_map)
#endif

-#ifndef node_distance
-#define node_distance(from,to) (from != to)
-#endif
-#ifndef PENALTY_FOR_NODE_WITH_CPUS
-#define PENALTY_FOR_NODE_WITH_CPUS (1)
-#endif
-
/* Cross-node load balancing interval. */
#ifndef NODE_BALANCE_RATE
#define NODE_BALANCE_RATE 10
diff -puN include/asm-i386/topology.h~numa-aware-zonelist-builder-fix-2 include/asm-i386/topology.h
--- 25/include/asm-i386/topology.h~numa-aware-zonelist-builder-fix-2 2004-03-03 23:40:22.000000000 -0800
+++ 25-akpm/include/asm-i386/topology.h 2004-03-03 23:41:33.000000000 -0800
@@ -67,10 +67,7 @@ static inline cpumask_t pcibus_to_cpumas
}

/* Node-to-Node distance */
-static inline int node_distance(int from, int to)
-{
- return (from != to);
-}
+#define node_distance(from, to) (from != to)

/* Cross-node load balancing interval. */
#define NODE_BALANCE_RATE 100
diff -puN include/linux/topology.h~numa-aware-zonelist-builder-fix-2 include/linux/topology.h
--- 25/include/linux/topology.h~numa-aware-zonelist-builder-fix-2 2004-03-03 23:40:22.000000000 -0800
+++ 25-akpm/include/linux/topology.h 2004-03-03 23:41:45.000000000 -0800
@@ -54,4 +54,11 @@ static inline int __next_node_with_cpus(
#define for_each_node_with_cpus(node) \
for (node = 0; node < numnodes; node = __next_node_with_cpus(node))

+#ifndef node_distance
+#define node_distance(from,to) (from != to)
+#endif
+#ifndef PENALTY_FOR_NODE_WITH_CPUS
+#define PENALTY_FOR_NODE_WITH_CPUS (1)
+#endif
+
#endif /* _LINUX_TOPOLOGY_H */

_