Commit 7c265fe6 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] create node_online_map

From Matthew Dobson.

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.
parent 6e8b708e
......@@ -52,6 +52,7 @@ static void __init smp_dump_qct(void)
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 */
......
......@@ -38,13 +38,11 @@ struct i386_cpu cpu_devices[NR_CPUS];
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 < NR_CPUS; i++)
if (cpu_possible(i)) arch_register_cpu(i);
......
......@@ -280,10 +280,25 @@ extern struct pglist_data contig_page_data;
#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)
......@@ -300,6 +315,14 @@ static inline unsigned int num_online_memblks(void)
#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) \
......
......@@ -31,6 +31,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment