Skip to contentSkip to conversation

Avoid checking for cpu gone when CONFIG_HOTPLUG_CPU not defined

PATCH Keshavamurthy, Anil S 3 participants 3 messages Apr 6, 2007 – Apr 9, 2007

lore
Share & tools
lore
#0 lore raw

Subject: Avoid checking for cpu gone when CONFIG_HOTPLUG_CPU not defined

Avoid checking for cpu gone in mm hot path when
CONFIG_HOTPLUG_CPU is not defined.

---
 arch/i386/kernel/smp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/i386/kernel/smp.c +3 -1
Index: work/arch/i386/kernel/smp.c
===================================================================
@@ -365,10 +365,12 @@ static void flush_tlb_others(cpumask_t c
 	BUG_ON(cpu_isset(smp_processor_id(), cpumask));
 	BUG_ON(!mm);
 
+#ifdef CONFIG_HOTPLUG_CPU
 	/* If a CPU which we ran on has gone down, OK. */
 	cpus_and(cpumask, cpumask, cpu_online_map);
-	if (cpus_empty(cpumask))
+	if (unlikely(cpus_empty(cpumask)))
 		return;
+#endif
 
 	/*
 	 * i'm not happy about this global shared spinlock in the
#1 lore raw
Quoted 19 lines · Anil S

Subject: Avoid checking for cpu gone when CONFIG_HOTPLUG_CPU not defined

Avoid checking for cpu gone in mm hot path when
CONFIG_HOTPLUG_CPU is not defined.

---
 arch/i386/kernel/smp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: work/arch/i386/kernel/smp.c
===================================================================

arch/i386/kernel/smp.c +0 -0
@@ -365,10 +365,12 @@ static void flush_tlb_others(cpumask_t c
 	BUG_ON(cpu_isset(smp_processor_id(), cpumask));
 	BUG_ON(!mm);
 

arch/i386/kernel/smp.c static void flush_tlb_others(cpumask_t c · line 376

Quoted 10 lines
arch/i386/kernel/smp.c +3 -1
+#ifdef CONFIG_HOTPLUG_CPU
 	/* If a CPU which we ran on has gone down, OK. */
 	cpus_and(cpumask, cpumask, cpu_online_map);
-	if (cpus_empty(cpumask))
+	if (unlikely(cpus_empty(cpumask)))
 		return;
+#endif
 
 	/*
 	 * i'm not happy about this global shared spinlock in the

Fair enough.

The code you're touching in with the original CPU-hotplug-for-i386 patches.

x86_64 doesn't do it. It handles tlb flushing differently anyway. But I suspect that x86_64 is just buggy, unless all callers of flush_tlb_others() have taken care to disable preemption prior to their calculation of the passed-in cpumask.

Shudder. Gautham, this is code which we can cheerfully delete when we get the freezer stuff done. Fortunately, Anil's patch will make it nice and easy to find again.

#2 lore raw
Quoted 36 lines · Andrew Morton
Quoted 19 lines · Anil S

Subject: Avoid checking for cpu gone when CONFIG_HOTPLUG_CPU not defined

Avoid checking for cpu gone in mm hot path when
CONFIG_HOTPLUG_CPU is not defined.

---
 arch/i386/kernel/smp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: work/arch/i386/kernel/smp.c
===================================================================

arch/i386/kernel/smp.c +0 -0
@@ -365,10 +365,12 @@ static void flush_tlb_others(cpumask_t c
 	BUG_ON(cpu_isset(smp_processor_id(), cpumask));
 	BUG_ON(!mm);
 

arch/i386/kernel/smp.c static void flush_tlb_others(cpumask_t c · line 376

Quoted 10 lines
arch/i386/kernel/smp.c +3 -1
+#ifdef CONFIG_HOTPLUG_CPU
 	/* If a CPU which we ran on has gone down, OK. */
 	cpus_and(cpumask, cpumask, cpu_online_map);
-	if (cpus_empty(cpumask))
+	if (unlikely(cpus_empty(cpumask)))
 		return;
+#endif
 
 	/*
 	 * i'm not happy about this global shared spinlock in the

Fair enough.

The code you're touching in with the original CPU-hotplug-for-i386 patches.

Quoted 8 lines

x86_64 doesn't do it. It handles tlb flushing differently anyway. But I suspect that x86_64 is just buggy, unless all callers of flush_tlb_others() have taken care to disable preemption prior to their calculation of the passed-in cpumask.

Shudder. Gautham, this is code which we can cheerfully delete when we get the freezer stuff done. Fortunately, Anil's patch will make it nice and easy to find again.

Ok, I will make a note of this one.

If the IO-test results are good, I hope to post the patchset sometime this week.

Thanks and Regards
gautham.

Signature · 5 lines
Gautham R Shenoy
Linux Technology Center
IBM India.
"Freedom comes with a price tag of responsibility, which is still a bargain,
because Freedom is priceless!"