Commit 996867d0 authored by Rusty Russell's avatar Rusty Russell

cpumask: convert arch/x86/kernel/cpu/mcheck/mce_64.c

Impact: reduce kernel memory usage when CONFIG_CPUMASK_OFFSTACK=y

Simple conversion of mce_device_initialized to cpumask_var_t.  We don't
check the alloc_cpumask_var() return since it's boot-time only, and
the misc_register() in that same function isn't checked.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 7ad728f9
...@@ -990,7 +990,7 @@ static struct sysdev_attribute *mce_attributes[] = { ...@@ -990,7 +990,7 @@ static struct sysdev_attribute *mce_attributes[] = {
NULL NULL
}; };
static cpumask_t mce_device_initialized = CPU_MASK_NONE; static cpumask_var_t mce_device_initialized;
/* Per cpu sysdev init. All of the cpus still share the same ctl bank */ /* Per cpu sysdev init. All of the cpus still share the same ctl bank */
static __cpuinit int mce_create_device(unsigned int cpu) static __cpuinit int mce_create_device(unsigned int cpu)
...@@ -1021,7 +1021,7 @@ static __cpuinit int mce_create_device(unsigned int cpu) ...@@ -1021,7 +1021,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
if (err) if (err)
goto error2; goto error2;
} }
cpu_set(cpu, mce_device_initialized); cpumask_set_cpu(cpu, mce_device_initialized);
return 0; return 0;
error2: error2:
...@@ -1043,7 +1043,7 @@ static __cpuinit void mce_remove_device(unsigned int cpu) ...@@ -1043,7 +1043,7 @@ static __cpuinit void mce_remove_device(unsigned int cpu)
{ {
int i; int i;
if (!cpu_isset(cpu, mce_device_initialized)) if (!cpumask_test_cpu(cpu, mce_device_initialized))
return; return;
for (i = 0; mce_attributes[i]; i++) for (i = 0; mce_attributes[i]; i++)
...@@ -1053,7 +1053,7 @@ static __cpuinit void mce_remove_device(unsigned int cpu) ...@@ -1053,7 +1053,7 @@ static __cpuinit void mce_remove_device(unsigned int cpu)
sysdev_remove_file(&per_cpu(device_mce, cpu), sysdev_remove_file(&per_cpu(device_mce, cpu),
&bank_attrs[i]); &bank_attrs[i]);
sysdev_unregister(&per_cpu(device_mce,cpu)); sysdev_unregister(&per_cpu(device_mce,cpu));
cpu_clear(cpu, mce_device_initialized); cpumask_clear_cpu(cpu, mce_device_initialized);
} }
/* Make sure there are no machine checks on offlined CPUs. */ /* Make sure there are no machine checks on offlined CPUs. */
...@@ -1162,6 +1162,8 @@ static __init int mce_init_device(void) ...@@ -1162,6 +1162,8 @@ static __init int mce_init_device(void)
if (!mce_available(&boot_cpu_data)) if (!mce_available(&boot_cpu_data))
return -EIO; return -EIO;
alloc_cpumask_var(&mce_device_initialized, GFP_KERNEL);
err = mce_init_banks(); err = mce_init_banks();
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment