From ad60ecb12aa0025c9488183a5098e5e3c3b14de7 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 11 Aug 2004 01:15:49 -0700 Subject: [PATCH] [SPARC64]: Change TIF_BLKCOMMIT into a fault code. Eliminates costly atomic bitops in do_sparc64_fault. Signed-off-by: David S. Miller --- arch/sparc64/lib/copy_page.S | 4 ++-- arch/sparc64/mm/fault.c | 4 ++-- include/asm-sparc64/thread_info.h | 16 +++++++--------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/arch/sparc64/lib/copy_page.S b/arch/sparc64/lib/copy_page.S index c7111e044b5a7..862eefb17f72d 100644 --- a/arch/sparc64/lib/copy_page.S +++ b/arch/sparc64/lib/copy_page.S @@ -168,9 +168,9 @@ copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ 9: VISEntry - ldx [%g6 + TI_FLAGS], %g3 + ldub [%g6 + TI_FAULT_CODE], %g3 mov %o0, %g1 - andcc %g3, _TIF_BLKCOMMIT, %g0 + cmp %g3, 0 rd %asi, %g3 be,a,pt %icc, 1f wr %g0, ASI_BLK_P, %asi diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 640c46ede0790..49c3dd29a5b69 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c @@ -428,7 +428,8 @@ good_area: if (tlb_type == spitfire && (vma->vm_flags & VM_EXEC) != 0 && vma->vm_file != NULL) - set_thread_flag(TIF_BLKCOMMIT); + set_thread_fault_code(fault_code | + FAULT_CODE_BLKCOMMIT); } else { /* Allow reads even for write-only mappings */ if (!(vma->vm_flags & (VM_READ | VM_EXEC))) @@ -497,6 +498,5 @@ do_sigbus: fault_done: /* These values are no longer needed, clear them. */ set_thread_fault_code(0); - clear_thread_flag(TIF_BLKCOMMIT); current_thread_info()->fault_address = 0; } diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h index f989fbdc53330..d1a5362606989 100644 --- a/include/asm-sparc64/thread_info.h +++ b/include/asm-sparc64/thread_info.h @@ -47,6 +47,7 @@ struct thread_info { struct pt_regs *kregs; struct exec_domain *exec_domain; int preempt_count; + int __pad; unsigned long *utraps; @@ -101,10 +102,11 @@ struct thread_info { #define TI_FPREGS 0x00000500 /* We embed this in the uppermost byte of thread_info->flags */ -#define FAULT_CODE_WRITE 0x01 /* Write access, implies D-TLB */ -#define FAULT_CODE_DTLB 0x02 /* Miss happened in D-TLB */ -#define FAULT_CODE_ITLB 0x04 /* Miss happened in I-TLB */ -#define FAULT_CODE_WINFIXUP 0x08 /* Miss happened during spill/fill */ +#define FAULT_CODE_WRITE 0x01 /* Write access, implies D-TLB */ +#define FAULT_CODE_DTLB 0x02 /* Miss happened in D-TLB */ +#define FAULT_CODE_ITLB 0x04 /* Miss happened in I-TLB */ +#define FAULT_CODE_WINFIXUP 0x08 /* Miss happened during spill/fill */ +#define FAULT_CODE_BLKCOMMIT 0x10 /* Use blk-commit ASI in copy_page */ #if PAGE_SHIFT == 13 #define THREAD_SIZE (2*PAGE_SIZE) @@ -218,10 +220,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); #define TIF_NEWSIGNALS 6 /* wants new-style signals */ #define TIF_32BIT 7 /* 32-bit binary */ #define TIF_NEWCHILD 8 /* just-spawned child process */ - -/* XXX Make this one FAULT_CODE_BLKCOMMIT XXX */ -#define TIF_BLKCOMMIT 9 /* use ASI_BLK_COMMIT_* in copy_user_page */ - +/* TIF_* value 9 is available */ #define TIF_POLLING_NRFLAG 10 #define TIF_SYSCALL_SUCCESS 11 /* NOTE: Thread flags >= 12 should be ones we have no interest @@ -239,7 +238,6 @@ register struct thread_info *current_thread_info_reg asm("g6"); #define _TIF_NEWSIGNALS (1<