diff options
author | Mike Travis <travis@sgi.com> | 2008-12-19 01:26:37 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-19 01:26:37 -0500 |
commit | 7b4967c532045a1983d6d4af5c69cc7c5109f62b (patch) | |
tree | 50f385985ed028b5316c1aad4b70ad08bd932e81 | |
parent | 7be7585393d311866653564fbcd10a3232773c0b (diff) |
cpumask: Add alloc_cpumask_var_node()
Impact: New API
This will be needed in x86 code to allocate the domain and old_domain
cpumasks on the same node as where the containing irq_cfg struct is
allocated.
(Also fixes double-dump_stack on rare CONFIG_DEBUG_PER_CPU_MAPS case)
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (re-impl alloc_cpumask_var)
-rw-r--r-- | include/linux/cpumask.h | 7 | ||||
-rw-r--r-- | lib/cpumask.c | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index d4bf52603e6b..b5ad19a6f43f 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -1025,6 +1025,7 @@ static inline size_t cpumask_size(void) | |||
1025 | #ifdef CONFIG_CPUMASK_OFFSTACK | 1025 | #ifdef CONFIG_CPUMASK_OFFSTACK |
1026 | typedef struct cpumask *cpumask_var_t; | 1026 | typedef struct cpumask *cpumask_var_t; |
1027 | 1027 | ||
1028 | bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); | ||
1028 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); | 1029 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); |
1029 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); | 1030 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); |
1030 | void free_cpumask_var(cpumask_var_t mask); | 1031 | void free_cpumask_var(cpumask_var_t mask); |
@@ -1038,6 +1039,12 @@ static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | |||
1038 | return true; | 1039 | return true; |
1039 | } | 1040 | } |
1040 | 1041 | ||
1042 | static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, | ||
1043 | int node) | ||
1044 | { | ||
1045 | return true; | ||
1046 | } | ||
1047 | |||
1041 | static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) | 1048 | static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) |
1042 | { | 1049 | { |
1043 | } | 1050 | } |
diff --git a/lib/cpumask.c b/lib/cpumask.c index 8d03f22c6ced..3f258f58c85b 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c | |||
@@ -76,15 +76,14 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) | |||
76 | 76 | ||
77 | /* These are not inline because of header tangles. */ | 77 | /* These are not inline because of header tangles. */ |
78 | #ifdef CONFIG_CPUMASK_OFFSTACK | 78 | #ifdef CONFIG_CPUMASK_OFFSTACK |
79 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | 79 | bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) |
80 | { | 80 | { |
81 | if (likely(slab_is_available())) | 81 | if (likely(slab_is_available())) |
82 | *mask = kmalloc(cpumask_size(), flags); | 82 | *mask = kmalloc_node(cpumask_size(), flags, node); |
83 | else { | 83 | else { |
84 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 84 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
85 | printk(KERN_ERR | 85 | printk(KERN_ERR |
86 | "=> alloc_cpumask_var: kmalloc not available!\n"); | 86 | "=> alloc_cpumask_var: kmalloc not available!\n"); |
87 | dump_stack(); | ||
88 | #endif | 87 | #endif |
89 | *mask = NULL; | 88 | *mask = NULL; |
90 | } | 89 | } |
@@ -96,6 +95,12 @@ bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | |||
96 | #endif | 95 | #endif |
97 | return *mask != NULL; | 96 | return *mask != NULL; |
98 | } | 97 | } |
98 | EXPORT_SYMBOL(alloc_cpumask_var_node); | ||
99 | |||
100 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | ||
101 | { | ||
102 | return alloc_cpumask_var_node(mask, flags, numa_node_id()); | ||
103 | } | ||
99 | EXPORT_SYMBOL(alloc_cpumask_var); | 104 | EXPORT_SYMBOL(alloc_cpumask_var); |
100 | 105 | ||
101 | void __init alloc_bootmem_cpumask_var(cpumask_var_t *mask) | 106 | void __init alloc_bootmem_cpumask_var(cpumask_var_t *mask) |