--- linux-2.6-npiggin/include/asm-sparc64/tlb.h | 6 +++++- linux-2.6-npiggin/kernel/fork.c | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff -puN include/asm-sparc64/mmu_context.h~vm-sparc64-updates include/asm-sparc64/mmu_context.h diff -puN include/asm-sparc64/tlb.h~vm-sparc64-updates include/asm-sparc64/tlb.h --- linux-2.6/include/asm-sparc64/tlb.h~vm-sparc64-updates 2004-10-30 12:29:49.000000000 +1000 +++ linux-2.6-npiggin/include/asm-sparc64/tlb.h 2004-10-30 12:30:46.000000000 +1000 @@ -44,7 +44,10 @@ extern void flush_tlb_pending(void); static inline struct mmu_gather *tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) { - struct mmu_gather *mp = &per_cpu(mmu_gathers, smp_processor_id()); + struct mmu_gather *mp; + + spin_lock(&mm->page_table_lock); + mp = &per_cpu(mmu_gathers, smp_processor_id()); BUG_ON(mp->tlb_nr); @@ -99,6 +102,7 @@ static inline void tlb_finish_mmu(struct /* keep the page table cache within bounds */ check_pgt_cache(); + spin_unlock(&mm->page_table_lock); } static inline unsigned int tlb_is_full_mm(struct mmu_gather *mp) diff -puN kernel/fork.c~vm-sparc64-updates kernel/fork.c --- linux-2.6/kernel/fork.c~vm-sparc64-updates 2004-10-30 12:31:11.000000000 +1000 +++ linux-2.6-npiggin/kernel/fork.c 2004-10-30 12:34:12.000000000 +1000 @@ -447,11 +447,12 @@ static int copy_mm(unsigned long clone_f */ /* * XXX: I think this is only needed for sparc64's tlb and - * context switching code - but sparc64 is in big trouble - * now anyway because tlb_gather_mmu can be done without - * holding the page table lock now anyway. + * context switching code - this should actually be an arch + * specific hook, but I'll just hack it for now. I'd rather + * it not to use the page table lock at all, but DaveM would + * probably think otherwise. */ -#if 0 +#ifdef CONFIG_SPARC64 spin_unlock_wait(&oldmm->page_table_lock); #endif goto good_mm; _