x86, mm, kprobes: fault.c, simplify notify_page_fault()

Previous thread: x86, mm: fault.c, simplify kmmio_fault() by Linux Kernel Mailing List on Saturday, March 28, 2009 - 2:22 pm. (1 message)

Next thread: x86, mm: fault.c, reorder functions by Linux Kernel Mailing List on Saturday, March 28, 2009 - 2:22 pm. (1 message)
From: Linux Kernel Mailing List
Date: Saturday, March 28, 2009 - 2:22 pm

Gitweb:     http://git.kernel.org/linus/b18018126f422f5b706fd750373425e10e84b486
Commit:     b18018126f422f5b706fd750373425e10e84b486
Parent:     b814d41f0987c7648d7ed07471258101c95c026b
Author:     Ingo Molnar <mingo@elte.hu>
AuthorDate: Fri Feb 20 22:42:57 2009 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat Feb 21 00:09:42 2009 +0100

    x86, mm, kprobes: fault.c, simplify notify_page_fault()
    
    Impact: cleanup
    
    Remove an #ifdef from notify_page_fault(). The function still
    compiles to nothing in the !CONFIG_KPROBES case.
    
    Introduce kprobes_built_in() and kprobe_fault_handler() helpers
    to allow this - they returns 0 if !CONFIG_KPROBES.
    
    No code changed:
    
       text	   data	    bss	    dec	    hex	filename
       4618	     32	     24	   4674	   1242	fault.o.before
       4618	     32	     24	   4674	   1242	fault.o.after
    
    Cc: Masami Hiramatsu <mhiramat@redhat.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/mm/fault.c     |    6 +-----
 include/linux/kprobes.h |   22 +++++++++++++++++++---
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index fe99af4..379beae 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -68,11 +68,10 @@ static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr)
 
 static inline int notify_page_fault(struct pt_regs *regs)
 {
-#ifdef CONFIG_KPROBES
 	int ret = 0;
 
 	/* kprobe_running() needs smp_processor_id() */
-	if (!user_mode_vm(regs)) {
+	if (kprobes_built_in() && !user_mode_vm(regs)) {
 		preempt_disable();
 		if (kprobe_running() && kprobe_fault_handler(regs, 14))
 			ret = 1;
@@ -80,9 +79,6 @@ static inline int notify_page_fault(struct pt_regs *regs)
 	}
 
 	return ret;
-#else
-	return 0;
-#endif
 }
 
 /*
diff --git a/include/linux/kprobes.h ...
Previous thread: x86, mm: fault.c, simplify kmmio_fault() by Linux Kernel Mailing List on Saturday, March 28, 2009 - 2:22 pm. (1 message)

Next thread: x86, mm: fault.c, reorder functions by Linux Kernel Mailing List on Saturday, March 28, 2009 - 2:22 pm. (1 message)