Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99988
b: refs/heads/master
c: 6a2f47c
h: refs/heads/master
v: v3
  • Loading branch information
Mike Travis authored and Ingo Molnar committed Jul 8, 2008
1 parent 6299c7d commit 9ea95f4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cd5dce2fb023a6f0168344b7dd8adec30017458e
refs/heads/master: 6a2f47ca27fad36f99e8478a3807d4b8c7db80e7
26 changes: 23 additions & 3 deletions trunk/arch/x86/kernel/setup_percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ int early_cpu_to_node(int cpu)
return per_cpu(x86_cpu_to_node_map, cpu);
}


/* empty cpumask */
static const cpumask_t cpu_mask_none;

/*
* Returns a pointer to the bitmask of CPUs on Node 'node'.
*/
Expand All @@ -358,13 +362,23 @@ cpumask_t *_node_to_cpumask_ptr(int node)
dump_stack();
return &cpu_online_map;
}
BUG_ON(node >= nr_node_ids);
return &node_to_cpumask_map[node];
if (node >= nr_node_ids) {
printk(KERN_WARNING
"_node_to_cpumask_ptr(%d): node > nr_node_ids(%d)\n",
node, nr_node_ids);
dump_stack();
return (cpumask_t *)&cpu_mask_none;
}
return (cpumask_t *)&node_to_cpumask_map[node];
}
EXPORT_SYMBOL(_node_to_cpumask_ptr);

/*
* Returns a bitmask of CPUs on Node 'node'.
*
* Side note: this function creates the returned cpumask on the stack
* so with a high NR_CPUS count, excessive stack space is used. The
* node_to_cpumask_ptr function should be used whenever possible.
*/
cpumask_t node_to_cpumask(int node)
{
Expand All @@ -374,7 +388,13 @@ cpumask_t node_to_cpumask(int node)
dump_stack();
return cpu_online_map;
}
BUG_ON(node >= nr_node_ids);
if (node >= nr_node_ids) {
printk(KERN_WARNING
"node_to_cpumask(%d): node > nr_node_ids(%d)\n",
node, nr_node_ids);
dump_stack();
return cpu_mask_none;
}
return node_to_cpumask_map[node];
}
EXPORT_SYMBOL(node_to_cpumask);
Expand Down
7 changes: 6 additions & 1 deletion trunk/include/asm-x86/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ static inline int cpu_to_node(int cpu)
}
#define early_cpu_to_node(cpu) cpu_to_node(cpu)

/* Returns a bitmask of CPUs on Node 'node'. */
/* Returns a bitmask of CPUs on Node 'node'.
*
* Side note: this function creates the returned cpumask on the stack
* so with a high NR_CPUS count, excessive stack space is used. The
* node_to_cpumask_ptr function should be used whenever possible.
*/
static inline cpumask_t node_to_cpumask(int node)
{
return node_to_cpumask_map[node];
Expand Down

0 comments on commit 9ea95f4

Please sign in to comment.