summaryrefslogtreecommitdiff
path: root/lib/cpumask.c
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-12-19 16:56:37 +1030
committerRusty Russell <rusty@rustcorp.com.au>2008-12-19 16:56:37 +1030
commit7b4967c532045a1983d6d4af5c69cc7c5109f62b (patch)
tree50f385985ed028b5316c1aad4b70ad08bd932e81 /lib/cpumask.c
parent7be7585393d311866653564fbcd10a3232773c0b (diff)
downloadlwn-7b4967c532045a1983d6d4af5c69cc7c5109f62b.tar.gz
lwn-7b4967c532045a1983d6d4af5c69cc7c5109f62b.zip
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)
Diffstat (limited to 'lib/cpumask.c')
-rw-r--r--lib/cpumask.c11
1 files changed, 8 insertions, 3 deletions
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)
/* These are not inline because of header tangles. */
#ifdef CONFIG_CPUMASK_OFFSTACK
-bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
+bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
{
if (likely(slab_is_available()))
- *mask = kmalloc(cpumask_size(), flags);
+ *mask = kmalloc_node(cpumask_size(), flags, node);
else {
#ifdef CONFIG_DEBUG_PER_CPU_MAPS
printk(KERN_ERR
"=> alloc_cpumask_var: kmalloc not available!\n");
- dump_stack();
#endif
*mask = NULL;
}
@@ -96,6 +95,12 @@ bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
#endif
return *mask != NULL;
}
+EXPORT_SYMBOL(alloc_cpumask_var_node);
+
+bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
+{
+ return alloc_cpumask_var_node(mask, flags, numa_node_id());
+}
EXPORT_SYMBOL(alloc_cpumask_var);
void __init alloc_bootmem_cpumask_var(cpumask_var_t *mask)