All of lore.kernel.org
 help / color / mirror / Atom feed
* + numa-generic-management-of-nodemasks-for-various-purposes.patch added to -mm tree
@ 2007-07-29  7:15 akpm
  2007-07-29 11:59 ` Paul Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: akpm @ 2007-07-29  7:15 UTC (permalink / raw)
  To: mm-commits; +Cc: lee.schermerhorn, bob.picco, clameter


The patch titled
     NUMA: Generic management of nodemasks for various purposes
has been added to the -mm tree.  Its filename is
     numa-generic-management-of-nodemasks-for-various-purposes.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: NUMA: Generic management of nodemasks for various purposes
From: Lee Schermerhorn <lee.schermerhorn@hp.com>

Preparation for memoryless node patches.

Provide a generic way to keep nodemasks describing various characteristics of
NUMA nodes.

Remove the node_online_map and the node_possible map and realize the whole
thing using two nodes stats: N_POSSIBLE and N_ONLINE.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Tested-by:  Lee Schermerhorn <lee.schermerhorn@hp.com>
Acked-by:  Lee Schermerhorn <lee.schermerhorn@hp.com>
Acked-by: Bob Picco <bob.picco@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/nodemask.h |   87 ++++++++++++++++++++++++++++++-------
 mm/page_alloc.c          |   13 ++---
 2 files changed, 78 insertions(+), 22 deletions(-)

diff -puN include/linux/nodemask.h~numa-generic-management-of-nodemasks-for-various-purposes include/linux/nodemask.h
--- a/include/linux/nodemask.h~numa-generic-management-of-nodemasks-for-various-purposes
+++ a/include/linux/nodemask.h
@@ -338,31 +338,81 @@ static inline void __nodes_remap(nodemas
 #endif /* MAX_NUMNODES */
 
 /*
+ * Bitmasks that are kept for all the nodes.
+ */
+enum node_states {
+	N_POSSIBLE,	/* The node could become online at some point */
+	N_ONLINE,	/* The node is online */
+	NR_NODE_STATES
+};
+
+/*
  * The following particular system nodemasks and operations
  * on them manage all possible and online nodes.
  */
 
-extern nodemask_t node_online_map;
-extern nodemask_t node_possible_map;
+extern nodemask_t node_states[NR_NODE_STATES];
 
 #if MAX_NUMNODES > 1
-#define num_online_nodes()	nodes_weight(node_online_map)
-#define num_possible_nodes()	nodes_weight(node_possible_map)
-#define node_online(node)	node_isset((node), node_online_map)
-#define node_possible(node)	node_isset((node), node_possible_map)
-#define first_online_node	first_node(node_online_map)
-#define next_online_node(nid)	next_node((nid), node_online_map)
+static inline int node_state(int node, enum node_states state)
+{
+	return node_isset(node, node_states[state]);
+}
+
+static inline void node_set_state(int node, enum node_states state)
+{
+	__node_set(node, &node_states[state]);
+}
+
+static inline void node_clear_state(int node, enum node_states state)
+{
+	__node_clear(node, &node_states[state]);
+}
+
+static inline int num_node_state(enum node_states state)
+{
+	return nodes_weight(node_states[state]);
+}
+
+#define for_each_node_state(__node, __state) \
+	for_each_node_mask((__node), node_states[__state])
+
+#define first_online_node	first_node(node_states[N_ONLINE])
+#define next_online_node(nid)	next_node((nid), node_states[N_ONLINE])
+
 extern int nr_node_ids;
 #else
-#define num_online_nodes()	1
-#define num_possible_nodes()	1
-#define node_online(node)	((node) == 0)
-#define node_possible(node)	((node) == 0)
+
+static inline int node_state(int node, enum node_states state)
+{
+	return node == 0;
+}
+
+static inline void node_set_state(int node, enum node_states state)
+{
+}
+
+static inline void node_clear_state(int node, enum node_states state)
+{
+}
+
+static inline int num_node_state(enum node_states state)
+{
+	return 1;
+}
+
+#define for_each_node_state(node, __state) \
+	for ( (node) = 0; (node) != 0; (node) = 1)
+
 #define first_online_node	0
 #define next_online_node(nid)	(MAX_NUMNODES)
 #define nr_node_ids		1
+
 #endif
 
+#define node_online_map 	node_states[N_ONLINE]
+#define node_possible_map 	node_states[N_POSSIBLE]
+
 #define any_online_node(mask)			\
 ({						\
 	int node;				\
@@ -372,10 +422,15 @@ extern int nr_node_ids;
 	node;					\
 })
 
-#define node_set_online(node)	   set_bit((node), node_online_map.bits)
-#define node_set_offline(node)	   clear_bit((node), node_online_map.bits)
+#define num_online_nodes()	num_node_state(N_ONLINE)
+#define num_possible_nodes()	num_node_state(N_POSSIBLE)
+#define node_online(node)	node_state((node), N_ONLINE)
+#define node_possible(node)	node_state((node), N_POSSIBLE)
+
+#define node_set_online(node)	   node_set_state((node), N_ONLINE)
+#define node_set_offline(node)	   node_clear_state((node), N_ONLINE)
 
-#define for_each_node(node)	   for_each_node_mask((node), node_possible_map)
-#define for_each_online_node(node) for_each_node_mask((node), node_online_map)
+#define for_each_node(node)	   for_each_node_state(node, N_POSSIBLE)
+#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
 
 #endif /* __LINUX_NODEMASK_H */
diff -puN mm/page_alloc.c~numa-generic-management-of-nodemasks-for-various-purposes mm/page_alloc.c
--- a/mm/page_alloc.c~numa-generic-management-of-nodemasks-for-various-purposes
+++ a/mm/page_alloc.c
@@ -48,13 +48,14 @@
 #include "internal.h"
 
 /*
- * MCD - HACK: Find somewhere to initialize this EARLY, or make this
- * initializer cleaner
+ * Array of node states.
  */
-nodemask_t node_online_map __read_mostly = { { [0] = 1UL } };
-EXPORT_SYMBOL(node_online_map);
-nodemask_t node_possible_map __read_mostly = NODE_MASK_ALL;
-EXPORT_SYMBOL(node_possible_map);
+nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
+	[N_POSSIBLE] = NODE_MASK_ALL,
+	[N_ONLINE] = { { [0] = 1UL } }
+};
+EXPORT_SYMBOL(node_states);
+
 unsigned long totalram_pages __read_mostly;
 unsigned long totalreserve_pages __read_mostly;
 long nr_swap_pages;
_

Patches currently in -mm which might be from lee.schermerhorn@hp.com are

numa-generic-management-of-nodemasks-for-various-purposes.patch
memoryless-nodes-introduce-mask-of-nodes-with-memory.patch
memoryless-nodes-fix-interleave-behavior.patch
oom-use-the-n_memory-map-instead-of-constructing-one-on-the-fly.patch
memoryless-nodes-no-need-for-kswapd.patch
memoryless-node-slab-support.patch
memoryless-nodes-slub-support.patch
uncached-allocator-handle-memoryless-nodes.patch
memoryless-node-allow-profiling-data-to-fall-back-to-other-nodes.patch
memoryless-nodes-update-memory-policy-and-page-migration.patch
add-n_cpu-node-state.patch
memoryless-nodes-fix-gfp_thisnode-behavior.patch
memoryless-nodes-use-node_memory_map-for-cpusets.patch
memoryless-nodes-drop-one-memoryless-node-boot-warning.patch

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

* Re: + numa-generic-management-of-nodemasks-for-various-purposes.patch added to -mm tree
  2007-07-29  7:15 + numa-generic-management-of-nodemasks-for-various-purposes.patch added to -mm tree akpm
@ 2007-07-29 11:59 ` Paul Jackson
  2007-07-30 21:43   ` Lee Schermerhorn
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Jackson @ 2007-07-29 11:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, mm-commits, lee.schermerhorn, bob.picco, clameter

Lee Schermerhorn (via Andrew) wrote:
> +static inline void node_set_state(int node, enum node_states state)
> +{
> +	__node_set(node, &node_states[state]);
> +}
> +
> +static inline void node_clear_state(int node, enum node_states state)
> +{
> +	__node_clear(node, &node_states[state]);
> +}


Lee - would you get the same result (same compiled binary code) with
something like:

+static inline void node_set_state(int node, enum node_states state)
+{
+	node_set(node, node_states[state]);
+}
+
+static inline void node_clear_state(int node, enum node_states state)
+{
+	node_clear(node, node_states[state]);
+}

If so, then I're prefer the latter, as it doesn't depend on the strange
#define wrapping an inline implementation of node_set and node_clear.

In other words, the latter looks 'simpler'.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

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

* Re: + numa-generic-management-of-nodemasks-for-various-purposes.patch added to -mm tree
  2007-07-29 11:59 ` Paul Jackson
@ 2007-07-30 21:43   ` Lee Schermerhorn
  2007-07-30 22:00     ` Christoph Lameter
  0 siblings, 1 reply; 4+ messages in thread
From: Lee Schermerhorn @ 2007-07-30 21:43 UTC (permalink / raw)
  To: Paul Jackson; +Cc: linux-kernel, akpm, mm-commits, bob.picco, clameter

On Sun, 2007-07-29 at 04:59 -0700, Paul Jackson wrote:
> Lee Schermerhorn (via Andrew) wrote:
> > +static inline void node_set_state(int node, enum node_states state)
> > +{
> > +	__node_set(node, &node_states[state]);
> > +}
> > +
> > +static inline void node_clear_state(int node, enum node_states state)
> > +{
> > +	__node_clear(node, &node_states[state]);
> > +}
> 
> 
> Lee - would you get the same result (same compiled binary code) with
> something like:
> 
> +static inline void node_set_state(int node, enum node_states state)
> +{
> +	node_set(node, node_states[state]);
> +}
> +
> +static inline void node_clear_state(int node, enum node_states state)
> +{
> +	node_clear(node, node_states[state]);
> +}
> 
> If so, then I're prefer the latter, as it doesn't depend on the strange
> #define wrapping an inline implementation of node_set and node_clear.
> 
> In other words, the latter looks 'simpler'.
> 

I'm OK with this, altho' I think Christoph was just following the lead
of the other node[s]_*() functions.  Care to submit a patch when you
return from vacation?

Christoph:  what do you think?

Lee


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

* Re: + numa-generic-management-of-nodemasks-for-various-purposes.patch added to -mm tree
  2007-07-30 21:43   ` Lee Schermerhorn
@ 2007-07-30 22:00     ` Christoph Lameter
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2007-07-30 22:00 UTC (permalink / raw)
  To: Lee Schermerhorn; +Cc: Paul Jackson, linux-kernel, akpm, mm-commits, bob.picco

On Mon, 30 Jul 2007, Lee Schermerhorn wrote:

> I'm OK with this, altho' I think Christoph was just following the lead
> of the other node[s]_*() functions.  Care to submit a patch when you
> return from vacation?

Right.
 
> Christoph:  what do you think?

I do not mind either way.

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

end of thread, other threads:[~2007-07-30 22:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-29  7:15 + numa-generic-management-of-nodemasks-for-various-purposes.patch added to -mm tree akpm
2007-07-29 11:59 ` Paul Jackson
2007-07-30 21:43   ` Lee Schermerhorn
2007-07-30 22:00     ` Christoph Lameter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.