Patchwork powerpc/mm: Fix switch_mmu_context to iterate of the proper list of cpus

login
register
mail settings
Submitter Kumar Gala
Date Aug. 5, 2009, 3:33 a.m.
Message ID <1249443212-25588-1-git-send-email-galak@kernel.crashing.org>
Download mbox | patch
Permalink /patch/30764/
State Accepted, archived
Commit 67050b5c3e9992d98554bd224d5a7898cc4881ff
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Kumar Gala - Aug. 5, 2009, 3:33 a.m.
Introduced a temporary variable into our iterating over the list cpus
that are threads on the same core.  For some reason Ben forgot how for
loops work.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/mm/mmu_context_nohash.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
Josh Boyer - Aug. 5, 2009, 11:32 a.m.
On Tue, Aug 04, 2009 at 10:33:32PM -0500, Kumar Gala wrote:
>Introduced a temporary variable into our iterating over the list cpus
>that are threads on the same core.  For some reason Ben forgot how for
>loops work.

Have the powerpoint demons corrupted him already??

josh
Michael Ellerman - Aug. 5, 2009, 12:52 p.m.
On Wed, 2009-08-05 at 07:32 -0400, Josh Boyer wrote:
> On Tue, Aug 04, 2009 at 10:33:32PM -0500, Kumar Gala wrote:
> >Introduced a temporary variable into our iterating over the list cpus
> >that are threads on the same core.  For some reason Ben forgot how for
> >loops work.
> 
> Have the powerpoint demons corrupted him already??

No I think one of his kids gave him swine flu.

cheers
Josh Boyer - Aug. 5, 2009, 1:16 p.m.
On Wed, Aug 05, 2009 at 10:52:22PM +1000, Michael Ellerman wrote:
>On Wed, 2009-08-05 at 07:32 -0400, Josh Boyer wrote:
>> On Tue, Aug 04, 2009 at 10:33:32PM -0500, Kumar Gala wrote:
>> >Introduced a temporary variable into our iterating over the list cpus
>> >that are threads on the same core.  For some reason Ben forgot how for
>> >loops work.
>> 
>> Have the powerpoint demons corrupted him already??
>
>No I think one of his kids gave him swine flu.

Whew.  You can recover from that at least ;)

josh

Patch

diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
index 6e8d2d9..9859dcd 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -190,7 +190,7 @@  static void context_check_map(void) { }
 
 void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
 {
-	unsigned int id, cpu = smp_processor_id();
+	unsigned int i, id, cpu = smp_processor_id();
 	unsigned long *map;
 
 	/* No lockless fast path .. yet */
@@ -268,9 +268,10 @@  void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
 		local_flush_tlb_mm(next);
 
 		/* XXX This clear should ultimately be part of local_flush_tlb_mm */
-		for (cpu = cpu_first_thread_in_core(cpu);
-		     cpu <= cpu_last_thread_in_core(cpu); cpu++)
-			__clear_bit(id, stale_map[cpu]);
+		for (i = cpu_first_thread_in_core(cpu);
+		     i <= cpu_last_thread_in_core(cpu); i++) {
+			__clear_bit(id, stale_map[i]);
+		}
 	}
 
 	/* Flick the MMU and release lock */