提交 38c7fed2 编写于 作者: Y Yinghai Lu 提交者: Pekka Enberg

x86: remove some alloc_bootmem_cpumask_var calling

Now that we set up the slab allocator earlier, we can get rid of some
alloc_bootmem_cpumask_var() calls in boot code.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NYinghai Lu <yinghai@kernel.org>
Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
上级 a5f4f52e
...@@ -185,8 +185,8 @@ int __init arch_early_irq_init(void) ...@@ -185,8 +185,8 @@ int __init arch_early_irq_init(void)
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
desc = irq_to_desc(i); desc = irq_to_desc(i);
desc->chip_data = &cfg[i]; desc->chip_data = &cfg[i];
alloc_bootmem_cpumask_var(&cfg[i].domain); alloc_cpumask_var(&cfg[i].domain, GFP_NOWAIT);
alloc_bootmem_cpumask_var(&cfg[i].old_domain); alloc_cpumask_var(&cfg[i].old_domain, GFP_NOWAIT);
if (i < NR_IRQS_LEGACY) if (i < NR_IRQS_LEGACY)
cpumask_setall(cfg[i].domain); cpumask_setall(cfg[i].domain);
} }
......
...@@ -432,21 +432,17 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); ...@@ -432,21 +432,17 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
static inline bool alloc_desc_masks(struct irq_desc *desc, int node, static inline bool alloc_desc_masks(struct irq_desc *desc, int node,
bool boot) bool boot)
{ {
#ifdef CONFIG_CPUMASK_OFFSTACK gfp_t gfp = GFP_ATOMIC;
if (boot) {
alloc_bootmem_cpumask_var(&desc->affinity);
#ifdef CONFIG_GENERIC_PENDING_IRQ if (boot)
alloc_bootmem_cpumask_var(&desc->pending_mask); gfp = GFP_NOWAIT;
#endif
return true;
}
if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node)) #ifdef CONFIG_CPUMASK_OFFSTACK
if (!alloc_cpumask_var_node(&desc->affinity, gfp, node))
return false; return false;
#ifdef CONFIG_GENERIC_PENDING_IRQ #ifdef CONFIG_GENERIC_PENDING_IRQ
if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) { if (!alloc_cpumask_var_node(&desc->pending_mask, gfp, node)) {
free_cpumask_var(desc->affinity); free_cpumask_var(desc->affinity);
return false; return false;
} }
......
...@@ -1857,7 +1857,7 @@ struct cgroup_subsys cpuset_subsys = { ...@@ -1857,7 +1857,7 @@ struct cgroup_subsys cpuset_subsys = {
int __init cpuset_init_early(void) int __init cpuset_init_early(void)
{ {
alloc_bootmem_cpumask_var(&top_cpuset.cpus_allowed); alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_NOWAIT);
top_cpuset.mems_generation = cpuset_mems_generation++; top_cpuset.mems_generation = cpuset_mems_generation++;
return 0; return 0;
......
...@@ -111,12 +111,6 @@ int __ref profile_init(void) ...@@ -111,12 +111,6 @@ int __ref profile_init(void)
/* only text is profiled */ /* only text is profiled */
prof_len = (_etext - _stext) >> prof_shift; prof_len = (_etext - _stext) >> prof_shift;
buffer_bytes = prof_len*sizeof(atomic_t); buffer_bytes = prof_len*sizeof(atomic_t);
if (!slab_is_available()) {
prof_buffer = alloc_bootmem(buffer_bytes);
alloc_bootmem_cpumask_var(&prof_cpu_mask);
cpumask_copy(prof_cpu_mask, cpu_possible_mask);
return 0;
}
if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL)) if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL))
return -ENOMEM; return -ENOMEM;
......
...@@ -92,15 +92,8 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) ...@@ -92,15 +92,8 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu)
*/ */
bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
{ {
if (likely(slab_is_available()))
*mask = kmalloc_node(cpumask_size(), flags, node); *mask = kmalloc_node(cpumask_size(), flags, node);
else {
#ifdef CONFIG_DEBUG_PER_CPU_MAPS
printk(KERN_ERR
"=> alloc_cpumask_var: kmalloc not available!\n");
#endif
*mask = NULL;
}
#ifdef CONFIG_DEBUG_PER_CPU_MAPS #ifdef CONFIG_DEBUG_PER_CPU_MAPS
if (!*mask) { if (!*mask) {
printk(KERN_ERR "=> alloc_cpumask_var: failed!\n"); printk(KERN_ERR "=> alloc_cpumask_var: failed!\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册