Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] Notify page fault call chain for ia64

Overloading of page fault notification with the notify_die() has performance
issues(since the only interested components for page fault is kprobes and/or
kdb) and hence this patch introduces the new notifier call chain exclusively
for page fault notifications their by avoiding notifying unnecessary
components in the do_page_fault() code path.

Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Anil S Keshavamurthy and committed by
Linus Torvalds
ae9a5b85 b71b5b65

+37 -1
+35 -1
arch/ia64/mm/fault.c
··· 19 19 20 20 extern void die (char *, struct pt_regs *, long); 21 21 22 + #ifdef CONFIG_KPROBES 23 + ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 24 + 25 + /* Hook to register for page fault notifications */ 26 + int register_page_fault_notifier(struct notifier_block *nb) 27 + { 28 + return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 29 + } 30 + 31 + int unregister_page_fault_notifier(struct notifier_block *nb) 32 + { 33 + return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb); 34 + } 35 + 36 + static inline int notify_page_fault(enum die_val val, const char *str, 37 + struct pt_regs *regs, long err, int trap, int sig) 38 + { 39 + struct die_args args = { 40 + .regs = regs, 41 + .str = str, 42 + .err = err, 43 + .trapnr = trap, 44 + .signr = sig 45 + }; 46 + return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args); 47 + } 48 + #else 49 + static inline int notify_page_fault(enum die_val val, const char *str, 50 + struct pt_regs *regs, long err, int trap, int sig) 51 + { 52 + return NOTIFY_DONE; 53 + } 54 + #endif 55 + 22 56 /* 23 57 * Return TRUE if ADDRESS points at a page in the kernel's mapped segment 24 58 * (inside region 5, on ia64) and that page is present. ··· 118 84 /* 119 85 * This is to handle the kprobes on user space access instructions 120 86 */ 121 - if (notify_die(DIE_PAGE_FAULT, "page fault", regs, code, TRAP_BRKPT, 87 + if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, code, TRAP_BRKPT, 122 88 SIGSEGV) == NOTIFY_STOP) 123 89 return; 124 90
+2
include/asm-ia64/kdebug.h
··· 40 40 41 41 extern int register_die_notifier(struct notifier_block *); 42 42 extern int unregister_die_notifier(struct notifier_block *); 43 + extern int register_page_fault_notifier(struct notifier_block *); 44 + extern int unregister_page_fault_notifier(struct notifier_block *); 43 45 extern struct atomic_notifier_head ia64die_chain; 44 46 45 47 enum die_val {