diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-07-03 08:30:37 -0500 |
---|---|---|
committer | Anders Roxell <anders.roxell@linaro.org> | 2015-05-08 22:30:03 +0200 |
commit | 487e021f9aab8afd17dfe2abc760d2992edd22ec (patch) | |
tree | 203f7fb88ce49cc72ad1a1792f8ed7ee8eef9233 /mm | |
parent | ef1613c19e7d4877a98d7fafc02ea48100d39d67 (diff) |
mm: Prepare decoupling the page fault disabling logic
Add a pagefault_disabled variable to task_struct to allow decoupling
the pagefault-disabled logic from the preempt count.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c index 90fb265b32b6..922073f7d1c5 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3244,6 +3244,36 @@ unlock: return 0; } +void pagefault_disable(void) +{ + preempt_count_inc(); + current->pagefault_disabled++; + /* + * make sure to have issued the store before a pagefault + * can hit. + */ + barrier(); +} +EXPORT_SYMBOL(pagefault_disable); + +void pagefault_enable(void) +{ +#ifndef CONFIG_PREEMPT + /* + * make sure to issue those last loads/stores before enabling + * the pagefault handler again. + */ + barrier(); + current->pagefault_disabled--; + preempt_count_dec(); +#else + barrier(); + current->pagefault_disabled--; + preempt_enable(); +#endif +} +EXPORT_SYMBOL(pagefault_enable); + /* * By the time we get here, we already hold the mm semaphore * |