Skip to contentSkip to conversation

arch/x86/mm/kmemcheck/kmemcheck.c: use max cpus

PATCH New Sudip Mukherjee 1 participant 1 message Oct 31, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/x86/mm/kmemcheck/kmemcheck.c: use max cpus

If SMP is enabled then to use kmemcheck we are limiting to one CPU. And if kmemcheck selftest fails, we are disabling kmemcheck and returning. But we are still using single CPU even though kmemcheck is disabled. Use the original max cpu value if kmemcheck selftest fails.

---
 arch/x86/mm/kmemcheck/kmemcheck.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/mm/kmemcheck/kmemcheck.c +8 -1
index b4f2e7e..4f09508 100644
@@ -52,8 +52,12 @@ int __init kmemcheck_init(void)
 #ifdef CONFIG_SMP
 	/*
 	 * Limit SMP to use a single CPU. We rely on the fact that this code
-	 * runs before SMP is set up.
+	 * runs before SMP is set up. Save the original value so that if
+	 * kmemcheck_selftest() fails we can use the original value
+	 * instead of using single CPU.
 	 */
+	unsigned int orig_max_cpu = setup_max_cpus;
+
 	if (setup_max_cpus > 1) {
 		printk(KERN_INFO
 			"kmemcheck: Limiting number of CPUs to 1.\n");
@@ -64,6 +68,9 @@ int __init kmemcheck_init(void)
 	if (!kmemcheck_selftest()) {
 		printk(KERN_INFO "kmemcheck: self-tests failed; disabling\n");
 		kmemcheck_enabled = 0;
+#ifdef CONFIG_SMP
+		setup_max_cpus = orig_max_cpu;
+#endif
 		return -EINVAL;
 	}
 
Signature · 1 line
1.9.1