aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/mm/fault.c
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2009-12-07 06:51:44 -0500
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2009-12-07 06:51:33 -0500
commit7ecb344ae80bc03397ded3b004e06ecfe32becf9 (patch)
tree2337ff84522741e9101b9a0a4cf3045a424561d3 /arch/s390/mm/fault.c
parentb11b53342773361f3353b285eb6a3fd6074e7997 (diff)
[S390] Improve notify_page_fault implementation.
notify_page_fault does a preempt_disable/preempt_enable for each fault generated by a kernel access to user space. If kprobes is not active that is unnecessary since the interrupts are not reenabled yet. To play safe repeat the kprobe_running check after preempt_disable(). Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/mm/fault.c')
-rw-r--r--arch/s390/mm/fault.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 77108e34fc1a..fd72c269cdb4 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -52,11 +52,11 @@
52extern int sysctl_userprocess_debug; 52extern int sysctl_userprocess_debug;
53#endif 53#endif
54 54
55#ifdef CONFIG_KPROBES 55static inline int notify_page_fault(struct pt_regs *regs)
56static inline int notify_page_fault(struct pt_regs *regs, long err)
57{ 56{
58 int ret = 0; 57 int ret = 0;
59 58
59#ifdef CONFIG_KPROBES
60 /* kprobe_running() needs smp_processor_id() */ 60 /* kprobe_running() needs smp_processor_id() */
61 if (!user_mode(regs)) { 61 if (!user_mode(regs)) {
62 preempt_disable(); 62 preempt_disable();
@@ -64,15 +64,9 @@ static inline int notify_page_fault(struct pt_regs *regs, long err)
64 ret = 1; 64 ret = 1;
65 preempt_enable(); 65 preempt_enable();
66 } 66 }
67 67#endif
68 return ret; 68 return ret;
69} 69}
70#else
71static inline int notify_page_fault(struct pt_regs *regs, long err)
72{
73 return 0;
74}
75#endif
76 70
77 71
78/* 72/*
@@ -274,7 +268,7 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int write,
274 int si_code; 268 int si_code;
275 int fault; 269 int fault;
276 270
277 if (notify_page_fault(regs, error_code)) 271 if (notify_page_fault(regs))
278 return; 272 return;
279 273
280 tsk = current; 274 tsk = current;