Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=608566b4edda5079c7812c2108a89c0fcf2894bb
Commit:     608566b4edda5079c7812c2108a89c0fcf2894bb
Parent:     f2857ce92023409df1544737d5b3499b4630a183
Author:     Harvey Harrison <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 30 13:33:12 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 13:33:12 2008 +0100

    x86: do_page_fault small unification
    
    Copy the prefetch of map_sem from X86_64 and move the check
    notify_page_fault (soon to be kprobe_handle_fault) out of
    the unlikely if() statement.
    
    This makes the X86_32|64 pagefault handlers closer to each
    other.
    
    Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
---
 arch/x86/mm/fault_32.c |   16 +++++++---------
 arch/x86/mm/fault_64.c |    7 ++-----
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c
index 36cb67e..52c13d2 100644
--- a/arch/x86/mm/fault_32.c
+++ b/arch/x86/mm/fault_32.c
@@ -295,13 +295,18 @@ void __kprobes do_page_fault(struct pt_regs *regs, 
unsigned long error_code)
         */
        trace_hardirqs_fixup();
 
+       tsk = current;
+       mm = tsk->mm;
+       prefetchw(&mm->mmap_sem);
+
        /* get the address */
        address = read_cr2();
 
-       tsk = current;
-
        si_code = SEGV_MAPERR;
 
+       if (notify_page_fault(regs))
+               return;
+
        /*
         * We fault-in kernel-space virtual memory on-demand. The
         * 'reference' page table is init_mm.pgd.
@@ -319,8 +324,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned 
long error_code)
                if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
                    vmalloc_fault(address) >= 0)
                        return;
-               if (notify_page_fault(regs))
-                       return;
                /*
                 * Don't take the mm semaphore here. If we fixup a prefetch
                 * fault we could otherwise deadlock.
@@ -328,16 +331,11 @@ void __kprobes do_page_fault(struct pt_regs *regs, 
unsigned long error_code)
                goto bad_area_nosemaphore;
        }
 
-       if (notify_page_fault(regs))
-               return;
-
        /* It's safe to allow irq's after cr2 has been saved and the vmalloc
           fault has been handled. */
        if (regs->flags & (X86_EFLAGS_IF|VM_MASK))
                local_irq_enable();
 
-       mm = tsk->mm;
-
        /*
         * If we're in an interrupt, have no user context or are running in an
         * atomic region then we must not take the fault.
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c
index 80f8436..c6b3ad5 100644
--- a/arch/x86/mm/fault_64.c
+++ b/arch/x86/mm/fault_64.c
@@ -355,6 +355,8 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs 
*regs,
 
        si_code = SEGV_MAPERR;
 
+       if (notify_page_fault(regs))
+               return;
 
        /*
         * We fault-in kernel-space virtual memory on-demand. The
@@ -380,8 +382,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs 
*regs,
                        if (vmalloc_fault(address) >= 0)
                                return;
                }
-               if (notify_page_fault(regs))
-                       return;
                /*
                 * Don't take the mm semaphore here. If we fixup a prefetch
                 * fault we could otherwise deadlock.
@@ -389,9 +389,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs 
*regs,
                goto bad_area_nosemaphore;
        }
 
-       if (notify_page_fault(regs))
-               return;
-
        if (likely(regs->flags & X86_EFLAGS_IF))
                local_irq_enable();
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to