switch_mm/enter_lazy_tlb Redundant CPU Args
Subsystems (5)
PATCH 1/1 switch_mm/enter_lazy_tlb Redundant CPU Args
Linus, please apply.
switch_mm and enter_lazy_tlb take a CPU arg, which is always smp_processor_id(). This is misleading, and pointless if they use per-cpu variables or other optimizations. gcc will eliminate redundant smp_processor_id() (in inline functions) anyway.
This removes that arg from all the architectures.
Name: switch_mm and enter_lazy_tlb: remove cpu arg
Author: Rusty Russell
Status: Booted on 2.5.74-bk4
D: switch_mm and enter_lazy_tlb take a CPU arg, which is always
D: smp_processor_id(). This is misleading, and pointless if they use
D: per-cpu variables or other optimizations. gcc will eliminate
D: redundant smp_processor_id() (in inline functions) anyway. D:
D: This removes that arg from all the architectures.
arch/cris/mm/tlb.c +1 -1
@@ -283,7 +283,7 @@ get_mmu_context(struct mm_struct *mm)void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,int cpu) +struct task_struct *tsk) {/* make sure we have a context */
arch/i386/kernel/cpu/common.c +1 -1
@@ -495,7 +495,7 @@ void __init cpu_init (void) current->active_mm = &init_mm;if (current->mm)BUG (); -enter_lazy_tlb (&init_mm, current, cpu); +enter_lazy_tlb (&init_mm, current);load_esp0 (t, thread->esp0);set_tss_desc (cpu,t);
arch/parisc/kernel/smp.c +1 -1
@@ -456,7 +456,7 @@ smp_cpu_init(int cpunum) current->active_mm = &init_mm;if (current->mm)BUG (); -enter_lazy_tlb (&init_mm, current, cpunum); +enter_lazy_tlb (&init_mm, current);init_IRQ ();/* make sure no IRQ's are enabled or pending */ }
arch/s390/kernel/setup.c +1 -1
@@ -107,7 +107,7 @@ void __devinit cpu_init (void) current->active_mm = &init_mm;if (current->mm)BUG (); -enter_lazy_tlb (&init_mm, current, nr); +enter_lazy_tlb (&init_mm, current); }/*
arch/um/kernel/process_kern.c +2 -1
@@ -113,8 +113,9 @@ int kernel_thread(int (*fn)(void *), voi }void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,unsigned cpu) +struct task_struct *tsk) { +unsigned cpu =smp_processor_id ();if (prev != next)clear_bit (cpu, &prev->cpu_vm_mask);set_bit (cpu, &next->cpu_vm_mask);
arch/x86_64/kernel/setup64.c +1 -1
@@ -288,7 +288,7 @@ void __init cpu_init (void) me->active_mm = &init_mm;if (me->mm)BUG (); -enter_lazy_tlb (&init_mm, me, cpu); +enter_lazy_tlb (&init_mm, me);set_tss_desc (cpu, t);load_TR_desc ();
fs/aio.c +1 -1
@@ -552,7 +552,7 @@ static void unuse_mm(struct mm_struct *m { current->mm =NULL ;/* active_mm is still 'mm' */ -enter_lazy_tlb (mm, current,smp_processor_id ()); +enter_lazy_tlb (mm, current); }/* Run on kevent's context. FIXME: needs to be per-cpu and warn if an
include/asm-alpha/machvec.h +1 -1
@@ -68,7 +68,7 @@ struct alpha_machine_vectorint (*mv_is_ioaddr)(unsigned long );void (*mv_switch_mm)(struct mm_struct *,struct mm_struct *, -struct task_struct *,long ); +struct task_struct *);void (*mv_activate_mm)(struct mm_struct *,struct mm_struct *);void (*mv_flush_tlb_current)(struct mm_struct *);
include/asm-alpha/mmu_context.h +8 -7
@@ -130,11 +130,12 @@ __get_new_mm_context(struct mm_struct *m __EXTERN_INLINE voidev5_switch_mm (struct mm_struct *prev_mm,struct mm_struct *next_mm, -struct task_struct *next,long cpu) +struct task_struct *next) {/* Check if our ASN is of an older version, and thus invalid. */ unsigned long asn;unsigned long mmc; +long cpu =smp_processor_id ();#ifdef CONFIG_SMP cpu_data[cpu].asn_lock =1 ;
@@ -159,7 +160,7 @@ ev5_switch_mm(struct mm_struct *prev_mm, __EXTERN_INLINE voidev4_switch_mm (struct mm_struct *prev_mm,struct mm_struct *next_mm, -struct task_struct *next,long cpu) +struct task_struct *next) {/* As described, ASN's are broken for TLB usage. But we can optimize for switching between threads -- if the mm is
@@ -174,7 +175,7 @@ ev4_switch_mm(struct mm_struct *prev_mm,/* Do continue to allocate ASNs, because we can still use them to avoid flushing the icache. */ -ev5_switch_mm (prev_mm, next_mm, next, cpu); +ev5_switch_mm (prev_mm, next_mm, next); }extern void __load_new_mm_context (struct mm_struct *);
@@ -212,14 +213,14 @@ ev4_activate_mm(struct mm_struct *prev_m#define deactivate_mm (tsk,mm) do { } while (0)#ifdef CONFIG_ALPHA_GENERIC -# define switch_mm (a,b,c,d) alpha_mv.mv_switch_mm((a),(b),(c),(d)) +# define switch_mm (a,b,c) alpha_mv.mv_switch_mm((a),(b),(c))# define activate_mm (x,y) alpha_mv.mv_activate_mm((x),(y))#else # ifdef CONFIG_ALPHA_EV4 -# define switch_mm (a,b,c,d) ev4_switch_mm((a),(b),(c),(d)) +# define switch_mm (a,b,c) ev4_switch_mm((a),(b),(c))# define activate_mm (x,y) ev4_activate_mm((x),(y))# else -# define switch_mm (a,b,c,d) ev5_switch_mm((a),(b),(c),(d)) +# define switch_mm (a,b,c) ev5_switch_mm((a),(b),(c))# define activate_mm (x,y) ev5_activate_mm((x),(y))# endif #endif
@@ -245,7 +246,7 @@ destroy_context(struct mm_struct *mm) }static inline void -enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { tsk->thread_info->pcb.ptbr = ((unsigned long )mm->pgd -IDENT_ADDR ) >>PAGE_SHIFT ;
include/asm-arm/mmu_context.h +2 -2
@@ -28,7 +28,7 @@* tsk->mm will be NULL */ static inline void -enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -40,7 +40,7 @@ enter_lazy_tlb(struct mm_struct *mm, str*/ static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,unsigned int cpu) +struct task_struct *tsk) {if (prev != next) {cpu_switch_mm (next->pgd, next);
include/asm-arm26/mmu_context.h +2 -2
@@ -26,7 +26,7 @@* tsk->mm will be NULL */ static inline void -enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -36,7 +36,7 @@ enter_lazy_tlb(struct mm_struct *mm, str*/ static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,unsigned int cpu) +struct task_struct *tsk) {cpu_switch_mm (next->pgd, next); }
include/asm-cris/mmu_context.h +3 -3
@@ -5,11 +5,11 @@ extern int init_new_context(struct task_extern void get_mmu_context (struct mm_struct *mm);extern void destroy_context (struct mm_struct *mm);extern void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,int cpu); +struct task_struct *tsk);#define deactivate_mm (tsk,mm) do { } while (0) -#define activate_mm (prev,next) switch_mm((prev),(next),NULL,smp_processor_id()) +#define activate_mm (prev,next) switch_mm((prev),(next),NULL)/* current active pgd - this is similar to other processors pgd * registers like cr3 on the i386
@@ -17,7 +17,7 @@ extern void switch_mm(struct mm_struct *extern volatile pgd_t *current_pgd;/* defined in arch/cris/mm/fault.c */ -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
include/asm-h8300/mmu_context.h +2 -2
@@ -6,7 +6,7 @@#include <asm/page.h> #include <asm/pgalloc.h> -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -20,7 +20,7 @@ init_new_context(struct task_struct *tsk#define destroy_context (mm) do { } while(0)#define deactivate_mm (tsk,mm) do { } while(0) -static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk,unsigned cpu) +static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk) { }
include/asm-i386/mmu_context.h +8 -3
@@ -14,16 +14,21 @@ int init_new_context(struct task_structvoid destroy_context (struct mm_struct *mm); -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) {#ifdef CONFIG_SMP +unsigned cpu =smp_processor_id ();if (cpu_tlbstate[cpu].state ==TLBSTATE_OK ) cpu_tlbstate[cpu].state =TLBSTATE_LAZY ;#endif } -static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk,unsigned cpu) +static inline void switch_mm (struct mm_struct *prev, +struct mm_struct *next, +struct task_struct *tsk) { +int cpu =smp_processor_id (); +if (likely (prev != next)) {/* stop flush ipis for the previous mm */ clear_bit (cpu, &prev->cpu_vm_mask);
@@ -62,6 +67,6 @@ static inline void switch_mm(struct mm_s asm("movl %0,%%fs ; movl %0,%%gs": :"r" (0))#define activate_mm (prev, next) \ - switch_mm((prev),(next),NULL,smp_processor_id()) + switch_mm((prev),(next),NULL)#endif
include/asm-ia64/mmu_context.h +2 -2
@@ -71,7 +71,7 @@ DECLARE_PER_CPU(u8, ia64_need_tlb_flush)extern void wrap_mmu_context (struct mm_struct *mm);static inline void -enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -198,7 +198,7 @@ activate_mm (struct mm_struct *prev, stractivate_context (next); } -#define switch_mm (prev_mm,next_mm,next_task,cpu) activate_mm(prev_mm, next_mm) +#define switch_mm (prev_mm,next_mm,next_task) activate_mm(prev_mm, next_mm)# endif /* ! __ASSEMBLY__ */ #endif /* _ASM_IA64_MMU_CONTEXT_H */
include/asm-m68k/mmu_context.h +3 -3
@@ -3,7 +3,7 @@#include <linux/config.h> -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -79,7 +79,7 @@ extern inline void switch_mm_0460(struct asmvolatile (".chip 68k" ); } -static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk,unsigned cpu) +static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk) {if (prev != next) {if (CPU_IS_020_OR_030 )
@@ -137,7 +137,7 @@ static inline void activate_context(strusun3_put_context (mm->context); } -static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk,unsigned cpu) +static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk) {activate_context (tsk->mm); }
include/asm-m68knommu/mmu_context.h +2 -2
@@ -6,7 +6,7 @@#include <asm/page.h> #include <asm/pgalloc.h> -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -19,7 +19,7 @@ init_new_context(struct task_struct *tsk#define destroy_context (mm) do { } while(0) -static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk,unsigned cpu) +static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk) { }
include/asm-mips/mmu_context.h +3 -2
@@ -49,7 +49,7 @@ extern unsigned long pgd_current[];#define cpu_asid (cpu, mm) (cpu_context((cpu), (mm)) & ASID_MASK)#define asid_cache (cpu) (cpu_data[cpu].asid_cache) -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -92,9 +92,10 @@ init_new_context(struct task_struct *tsk }static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,unsigned cpu) +struct task_struct *tsk) {unsigned long flags; +unsigned cpu =smp_processor_id ();local_irq_save (flags);
include/asm-mips64/mmu_context.h +1 -1
@@ -40,7 +40,7 @@ extern unsigned long pgd_current[];#define cpu_asid (cpu, mm) (cpu_context((cpu), (mm)) & ASID_MASK)#define asid_cache (cpu) (cpu_data[cpu].asid_cache) -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
include/asm-parisc/mmu_context.h +3 -3
@@ -6,7 +6,7 @@#include <asm/pgalloc.h> #include <asm/pgtable.h> -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -43,7 +43,7 @@ static inline void load_context(mm_conte#endif } -static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk,unsigned cpu) +static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk) {if (prev != next) {
@@ -69,6 +69,6 @@ static inline void activate_mm(struct mmif (next->context ==0 ) next->context =alloc_sid (); - switch_mm(prev,next,current,0); + switch_mm(prev,next,current); }#endif
include/asm-ppc/mmu_context.h +2 -2
@@ -48,7 +48,7 @@-- Dan */ -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -153,7 +153,7 @@ static inline void destroy_context(struc }static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,int cpu) +struct task_struct *tsk) { tsk->thread.pgdir = next->pgd;get_mmu_context (next);
include/asm-ppc64/mmu_context.h +4 -4
@@ -56,7 +56,7 @@ struct mmu_context_queue_t {extern struct mmu_context_queue_t mmu_context_queue;static inline void -enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -140,10 +140,10 @@ extern void flush_stab(struct task_struc*/ static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,int cpu) +struct task_struct *tsk) {flush_stab (tsk, next); -set_bit (cpu, &next->cpu_vm_mask); +set_bit (smp_processor_id (), &next->cpu_vm_mask); }#define deactivate_mm (tsk,mm) do { } while (0)
@@ -153,7 +153,7 @@ switch_mm(struct mm_struct *prev, struct* the context for the new mm so we see the new mappings. */ #define activate_mm (active_mm, mm) \ - switch_mm(active_mm, mm, current, smp_processor_id()); + switch_mm(active_mm, mm, current);#define VSID_RANDOMIZER 42470972311#define VSID_MASK 0xfffffffff
include/asm-s390/mmu_context.h +4 -4
@@ -17,12 +17,12 @@#define destroy_context (mm) flush_tlb_mm(mm)static inline void enter_lazy_tlb (struct mm_struct *mm, -struct task_struct *tsk,unsigned cpu) +struct task_struct *tsk) { }static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,unsigned cpu) +struct task_struct *tsk) {unsigned long pgd;
@@ -42,7 +42,7 @@ static inline void switch_mm(struct mm_s : : "m" (pgd) );#endif /* __s390x__ */ } -set_bit (cpu, &next->cpu_vm_mask); +set_bit (smp_processor_id (), &next->cpu_vm_mask); }#define deactivate_mm (tsk,mm) do { } while (0)
@@ -50,7 +50,7 @@ static inline void switch_mm(struct mm_sextern inline void activate_mm (struct mm_struct *prev,struct mm_struct *next) { -switch_mm (prev, next, current,smp_processor_id ()); +switch_mm (prev, next, current); }#endif
include/asm-sh/mmu_context.h +5 -5
@@ -129,7 +129,7 @@ static __inline__ void activate_context((Currently not used) */ static __inline__void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,unsigned int cpu) +struct task_struct *tsk) {if (likely (prev != next)) {unsigned long __pgdir = (unsigned long )next->pgd;
@@ -144,10 +144,10 @@ static __inline__ void switch_mm(struct#define deactivate_mm (tsk,mm) do { } while (0)#define activate_mm (prev, next) \ - switch_mm((prev),(next),NULL,smp_processor_id()) + switch_mm((prev),(next),NULL)static __inline__void -enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }#else /* !CONFIG_MMU */
@@ -157,10 +157,10 @@ enter_lazy_tlb(struct mm_struct *mm, str#define set_asid (asid) do { } while (0)#define get_asid () (0)#define activate_context (mm) do { } while (0) -#define switch_mm (prev,next,tsk,cpu) do { } while (0) +#define switch_mm (prev,next,tsk) do { } while (0)#define deactivate_mm (tsk,mm) do { } while (0)#define activate_mm (prev,next) do { } while (0) -#define enter_lazy_tlb (mm,tsk,cpu) do { } while (0) +#define enter_lazy_tlb (mm,tsk) do { } while (0)#endif /* CONFIG_MMU */ #if defined(CONFIG_CPU_SH3 ) || defined(CONFIG_CPU_SH4 )
include/asm-sparc/mmu_context.h +4 -4
@@ -5,7 +5,7 @@#ifndef __ASSEMBLY__ -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -26,14 +26,14 @@ BTFIXUPDEF_CALL(void, destroy_context, s#define destroy_context (mm) BTFIXUP_CALL(destroy_context)(mm)/* Switch the current MM context. */ -BTFIXUPDEF_CALL(void, switch_mm, struct mm_struct *, struct mm_struct *, struct task_struct *, int) +BTFIXUPDEF_CALL(void, switch_mm, struct mm_struct *, struct mm_struct *, struct task_struct *) -#define switch_mm (old_mm, mm, tsk, cpu) BTFIXUP_CALL(switch_mm)(old_mm, mm, tsk, cpu) +#define switch_mm(old_mm, mm, tsk) BTFIXUP_CALL(switch_mm)(old_mm, mm, tsk) #define deactivate_mm(tsk,mm) do { } while (0) /* Activate a new MM instance for the current task. */ -#define activate_mm (active_mm, mm) switch_mm((active_mm), (mm), NULL, smp_processor_id()) +#define activate_mm (active_mm, mm) switch_mm((active_mm), (mm), NULL)#endif /* !(__ASSEMBLY__) */
include/asm-sparc64/mmu_context.h +3 -3
@@ -27,7 +27,7 @@#include <asm/system.h> #include <asm/spitfire.h> -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }
@@ -106,7 +106,7 @@ do { \extern void __flush_tlb_mm (unsigned long ,unsigned long );/* Switch the current MM context. */ -static inline void switch_mm (struct mm_struct *old_mm,struct mm_struct *mm,struct task_struct *tsk,int cpu) +static inline void switch_mm (struct mm_struct *old_mm,struct mm_struct *mm,struct task_struct *tsk) {unsigned long ctx_valid;
@@ -125,7 +125,7 @@ static inline void switch_mm(struct mm_s } { -unsigned long vm_mask = (1UL << cpu); +unsigned long vm_mask = (1UL <<smp_processor_id ());/* Even if (mm == old_mm) we _must_ check * the cpu_vm_mask. If we do not we could
include/asm-um/mmu_context.h +4 -2
@@ -21,8 +21,10 @@ static inline void activate_mm(struct mmextern void switch_mm_skas (int mm_fd);static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,unsigned cpu) +struct task_struct *tsk) { +unsigned cpu =smp_processor_id (); +if (prev != next){clear_bit (cpu, &prev->cpu_vm_mask);set_bit (cpu, &next->cpu_vm_mask);
@@ -33,7 +35,7 @@ static inline void switch_mm(struct mm_s }static inline void enter_lazy_tlb (struct mm_struct *mm, -struct task_struct *tsk,unsigned cpu) +struct task_struct *tsk) { }
include/asm-v850/mmu_context.h +2 -2
@@ -3,9 +3,9 @@#define destroy_context (mm) ((void)0)#define init_new_context (tsk,mm) 0 -#define switch_mm (prev,next,tsk,cpu) ((void)0) +#define switch_mm (prev,next,tsk) ((void)0)#define deactivate_mm (tsk,mm) do { } while (0)#define activate_mm (prev,next) ((void)0) -#define enter_lazy_tlb (mm,tsk,cpu) ((void)0) +#define enter_lazy_tlb (mm,tsk) ((void)0)#endif /* __V850_MMU_CONTEXT_H__ */
include/asm-x86_64/mmu_context.h +5 -4
@@ -17,20 +17,21 @@ void destroy_context(struct mm_struct *m#ifdef CONFIG_SMP -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) {if (read_pda (mmu_state) ==TLBSTATE_OK )write_pda (mmu_state,TLBSTATE_LAZY ); }#else -static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk,unsigned cpu) +static inline void enter_lazy_tlb (struct mm_struct *mm,struct task_struct *tsk) { }#endif static inline void switch_mm (struct mm_struct *prev,struct mm_struct *next, -struct task_struct *tsk,unsigned cpu) +struct task_struct *tsk) { +unsigned cpu =smp_processor_id ();if (likely (prev != next)) {/* stop flush ipis for the previous mm */ clear_bit (cpu, &prev->cpu_vm_mask);
@@ -68,7 +69,7 @@ static inline void switch_mm(struct mm_s } while(0)#define activate_mm (prev, next) \ - switch_mm((prev),(next),NULL,smp_processor_id()) + switch_mm((prev),(next),NULL)#endif
kernel/exit.c +1 -1
@@ -443,7 +443,7 @@ static inline void __exit_mm(struct task/* more a memory barrier than a real lock */ task_lock (tsk); tsk->mm =NULL ; -enter_lazy_tlb (mm, current,smp_processor_id ()); +enter_lazy_tlb (mm, current);task_unlock (tsk);mmput (mm); }
kernel/sched.c +3 -3
@@ -646,9 +646,9 @@ static inline task_t * context_switch(ruif (unlikely (!mm)) { next->active_mm = oldmm;atomic_inc (&oldmm->mm_count); -enter_lazy_tlb (oldmm, next,smp_processor_id ()); +enter_lazy_tlb (oldmm, next); }else -switch_mm (oldmm, mm, next,smp_processor_id ()); +switch_mm (oldmm, mm, next);if (unlikely (!prev->mm)) { prev->active_mm =NULL ;
@@ -2527,7 +2527,7 @@ void __init sched_init(void)* The boot idle thread does lazy MMU switching as well: */ atomic_inc (&init_mm.mm_count); -enter_lazy_tlb (&init_mm, current,smp_processor_id ()); +enter_lazy_tlb (&init_mm, current); }#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.