All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: Andrew Morton <akpm@digeo.com>
Cc: Patrick Mochel <mochel@osdl.org>,
	"Martin J. Bligh" <mbligh@aracnet.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Michael Hohnbaum <hohnbaum@us.ibm.com>
Subject: Re: [patch] (5/5) create node_online_map 2.5.44
Date: Wed, 23 Oct 2002 14:06:23 -0700	[thread overview]
Message-ID: <3DB70F4F.2000203@us.ibm.com> (raw)
In-Reply-To: 3DB70F01.9050906@us.ibm.com

[-- Attachment #1: Type: text/plain, Size: 333 bytes --]

Create and use node_online_map.

This patch creates a node_online_map, much like cpu_online_map.  It
also creates the standard helper functions, ie: node_online(),
num_online_nodes(), node_set_online(), node_set_offline().

This is used by driverFS topology to keep track of which Nodes
are in the system and online.

Cheers!

-Matt

[-- Attachment #2: 04-node_online_map.patch --]
[-- Type: text/plain, Size: 3306 bytes --]

diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.44-base/arch/i386/kernel/numaq.c linux-2.5.44-node_online_map/arch/i386/kernel/numaq.c
--- linux-2.5.44-base/arch/i386/kernel/numaq.c	Fri Oct 18 21:01:17 2002
+++ linux-2.5.44-node_online_map/arch/i386/kernel/numaq.c	Wed Oct 23 12:14:49 2002
@@ -52,6 +52,7 @@
 	numnodes = 0;
 	for(node = 0; node < MAX_NUMNODES; node++) {
 		if(scd->quads_present31_0 & (1 << node)) {
+			node_set_online(node);
 			numnodes++;
 			eq = &scd->eq[node];
 			/* Convert to pages */
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.44-base/arch/i386/mach-generic/topology.c linux-2.5.44-node_online_map/arch/i386/mach-generic/topology.c
--- linux-2.5.44-base/arch/i386/mach-generic/topology.c	Wed Oct 23 12:13:31 2002
+++ linux-2.5.44-node_online_map/arch/i386/mach-generic/topology.c	Wed Oct 23 12:14:50 2002
@@ -38,13 +38,11 @@
 struct i386_node node_devices[MAX_NUMNODES];
 struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
 
-extern int numnodes;
-
 static int __init topology_init(void)
 {
 	int i;
 
-	for (i = 0; i < numnodes; i++)
+	for (i = 0; i < num_online_nodes(); i++)
 		arch_register_node(i);
 	for (i = 0; i < num_online_cpus(); i++)
 		arch_register_cpu(i);
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.44-base/include/linux/mmzone.h linux-2.5.44-node_online_map/include/linux/mmzone.h
--- linux-2.5.44-base/include/linux/mmzone.h	Wed Oct 23 12:13:31 2002
+++ linux-2.5.44-node_online_map/include/linux/mmzone.h	Wed Oct 23 12:14:50 2002
@@ -263,10 +263,25 @@
 #endif /* !CONFIG_DISCONTIGMEM */
 
 
+extern DECLARE_BITMAP(node_online_map, MAX_NUMNODES);
 extern DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS);
 
 #if defined(CONFIG_DISCONTIGMEM) || defined(CONFIG_NUMA)
 
+#define node_online(node)	test_bit(node, node_online_map)
+#define node_set_online(node)	set_bit(node, node_online_map)
+#define node_set_offline(node)	clear_bit(node, node_online_map)
+static inline unsigned int num_online_nodes(void)
+{
+	int i, num = 0;
+
+	for(i = 0; i < MAX_NUMNODES; i++){
+		if (node_online(i))
+			num++;
+	}
+	return num;
+}
+
 #define memblk_online(memblk)		test_bit(memblk, memblk_online_map)
 #define memblk_set_online(memblk)	set_bit(memblk, memblk_online_map)
 #define memblk_set_offline(memblk)	clear_bit(memblk, memblk_online_map)
@@ -283,6 +298,14 @@
 
 #else /* !CONFIG_DISCONTIGMEM && !CONFIG_NUMA */
 
+#define node_online(node) \
+	({ BUG_ON((node) != 0); test_bit(node, node_online_map); })
+#define node_set_online(node) \
+	({ BUG_ON((node) != 0); set_bit(node, node_online_map); })
+#define node_set_offline(node) \
+	({ BUG_ON((node) != 0); clear_bit(node, node_online_map); })
+#define num_online_nodes()	1
+
 #define memblk_online(memblk) \
 	({ BUG_ON((memblk) != 0); test_bit(memblk, memblk_online_map); })
 #define memblk_set_online(memblk) \
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.44-base/mm/page_alloc.c linux-2.5.44-node_online_map/mm/page_alloc.c
--- linux-2.5.44-base/mm/page_alloc.c	Wed Oct 23 12:13:31 2002
+++ linux-2.5.44-node_online_map/mm/page_alloc.c	Wed Oct 23 12:14:50 2002
@@ -28,6 +28,7 @@
 
 #include <asm/topology.h>
 
+DECLARE_BITMAP(node_online_map, MAX_NUMNODES);
 DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS);
 struct pglist_data *pgdat_list;
 unsigned long totalram_pages;

      reply	other threads:[~2002-10-23 21:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2699066091.1035310557@[10.10.2.3]>
     [not found] ` <Pine.LNX.4.44.0210221824430.983-100000@cherise.pdx.osdl.net>
     [not found]   ` <3DB5FCC5.E54808E@digeo.com>
2002-10-23 20:55     ` [patch] (1/5) Core driverfs Topology 2.5.44 Matthew Dobson
2002-10-23 20:59       ` [patch] (2/5) i386 " Matthew Dobson
2002-10-23 21:02         ` [patch] (3/5) NUMA meminfo for " Matthew Dobson
2002-10-23 21:05           ` [patch] (4/5) create memblk_online_map 2.5.44 Matthew Dobson
2002-10-23 21:06             ` Matthew Dobson [this message]

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=3DB70F4F.2000203@us.ibm.com \
    --to=colpatch@us.ibm.com \
    --cc=akpm@digeo.com \
    --cc=hohnbaum@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    --cc=mochel@osdl.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 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.