diff options
| author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2015-05-11 11:52:20 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2015-05-19 02:39:18 -0400 |
| commit | 8222dbe21e79338de92d5e1956cd1e3994cc9f93 (patch) | |
| tree | ff005f0ab91b16776311fc7082dec9668bc036c2 | |
| parent | 76deabd1867d6d2895152f31fdec819e3505738b (diff) | |
sched/preempt, mm/fault: Decouple preemption from the page fault logic
As the fault handlers now all rely on the pagefault_disabled() checks
and implicit preempt_disable() calls by pagefault_disable() have been
made explicit, we can completely rely on the pagefault_disableD counter.
So let's no longer touch the preempt count when disabling/enabling
pagefaults. After a call to pagefault_disable(), pagefault_disabled()
will return true, but in_atomic() won't.
Reviewed-and-tested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: David.Laight@ACULAB.COM
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: airlied@linux.ie
Cc: akpm@linux-foundation.org
Cc: benh@kernel.crashing.org
Cc: bigeasy@linutronix.de
Cc: borntraeger@de.ibm.com
Cc: daniel.vetter@intel.com
Cc: heiko.carstens@de.ibm.com
Cc: herbert@gondor.apana.org.au
Cc: hocko@suse.cz
Cc: hughd@google.com
Cc: mst@redhat.com
Cc: paulus@samba.org
Cc: ralf@linux-mips.org
Cc: schwidefsky@de.ibm.com
Cc: yang.shi@windriver.com
Link: http://lkml.kernel.org/r/1431359540-32227-16-git-send-email-dahi@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
| -rw-r--r-- | include/linux/uaccess.h | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 90786d2d74e5..ae572c138607 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | #ifndef __LINUX_UACCESS_H__ | 1 | #ifndef __LINUX_UACCESS_H__ |
| 2 | #define __LINUX_UACCESS_H__ | 2 | #define __LINUX_UACCESS_H__ |
| 3 | 3 | ||
| 4 | #include <linux/preempt.h> | ||
| 5 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
| 6 | #include <asm/uaccess.h> | 5 | #include <asm/uaccess.h> |
| 7 | 6 | ||
| @@ -20,17 +19,11 @@ static __always_inline void pagefault_disabled_dec(void) | |||
| 20 | * These routines enable/disable the pagefault handler. If disabled, it will | 19 | * These routines enable/disable the pagefault handler. If disabled, it will |
| 21 | * not take any locks and go straight to the fixup table. | 20 | * not take any locks and go straight to the fixup table. |
| 22 | * | 21 | * |
| 23 | * We increase the preempt and the pagefault count, to be able to distinguish | 22 | * User access methods will not sleep when called from a pagefault_disabled() |
| 24 | * whether we run in simple atomic context or in a real pagefault_disable() | 23 | * environment. |
| 25 | * context. | ||
| 26 | * | ||
| 27 | * For now, after pagefault_disabled() has been called, we run in atomic | ||
| 28 | * context. User access methods will not sleep. | ||
| 29 | * | ||
| 30 | */ | 24 | */ |
| 31 | static inline void pagefault_disable(void) | 25 | static inline void pagefault_disable(void) |
| 32 | { | 26 | { |
| 33 | preempt_count_inc(); | ||
| 34 | pagefault_disabled_inc(); | 27 | pagefault_disabled_inc(); |
| 35 | /* | 28 | /* |
| 36 | * make sure to have issued the store before a pagefault | 29 | * make sure to have issued the store before a pagefault |
| @@ -47,11 +40,6 @@ static inline void pagefault_enable(void) | |||
| 47 | */ | 40 | */ |
| 48 | barrier(); | 41 | barrier(); |
| 49 | pagefault_disabled_dec(); | 42 | pagefault_disabled_dec(); |
| 50 | #ifndef CONFIG_PREEMPT | ||
| 51 | preempt_count_dec(); | ||
| 52 | #else | ||
| 53 | preempt_enable(); | ||
| 54 | #endif | ||
| 55 | } | 43 | } |
| 56 | 44 | ||
| 57 | /* | 45 | /* |
