Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v2.6.32 67 lines 1.6 kB view raw
1/* Common code for 32 and 64-bit NUMA */ 2#include <linux/topology.h> 3#include <linux/module.h> 4#include <linux/bootmem.h> 5 6#ifdef CONFIG_DEBUG_PER_CPU_MAPS 7# define DBG(x...) printk(KERN_DEBUG x) 8#else 9# define DBG(x...) 10#endif 11 12/* 13 * Which logical CPUs are on which nodes 14 */ 15cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; 16EXPORT_SYMBOL(node_to_cpumask_map); 17 18/* 19 * Allocate node_to_cpumask_map based on number of available nodes 20 * Requires node_possible_map to be valid. 21 * 22 * Note: node_to_cpumask() is not valid until after this is done. 23 * (Use CONFIG_DEBUG_PER_CPU_MAPS to check this.) 24 */ 25void __init setup_node_to_cpumask_map(void) 26{ 27 unsigned int node, num = 0; 28 29 /* setup nr_node_ids if not done yet */ 30 if (nr_node_ids == MAX_NUMNODES) { 31 for_each_node_mask(node, node_possible_map) 32 num = node; 33 nr_node_ids = num + 1; 34 } 35 36 /* allocate the map */ 37 for (node = 0; node < nr_node_ids; node++) 38 alloc_bootmem_cpumask_var(&node_to_cpumask_map[node]); 39 40 /* cpumask_of_node() will now work */ 41 pr_debug("Node to cpumask map for %d nodes\n", nr_node_ids); 42} 43 44#ifdef CONFIG_DEBUG_PER_CPU_MAPS 45/* 46 * Returns a pointer to the bitmask of CPUs on Node 'node'. 47 */ 48const struct cpumask *cpumask_of_node(int node) 49{ 50 if (node >= nr_node_ids) { 51 printk(KERN_WARNING 52 "cpumask_of_node(%d): node > nr_node_ids(%d)\n", 53 node, nr_node_ids); 54 dump_stack(); 55 return cpu_none_mask; 56 } 57 if (node_to_cpumask_map[node] == NULL) { 58 printk(KERN_WARNING 59 "cpumask_of_node(%d): no node_to_cpumask_map!\n", 60 node); 61 dump_stack(); 62 return cpu_online_mask; 63 } 64 return node_to_cpumask_map[node]; 65} 66EXPORT_SYMBOL(cpumask_of_node); 67#endif