lkml.org 
[lkml]   [2002]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch] (5/5) create node_online_map 2.5.44
This is a multi-part message in MIME format.
--------------010803040507040501000907
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------010803040507040501000907
Content-Type: text/plain;
name="04-node_online_map.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="04-node_online_map.patch"

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;
--------------010803040507040501000907--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:30    [W:0.039 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site