summaryrefslogtreecommitdiff
path: root/mm/memory.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-07-03 08:30:37 -0500
committerClark Williams <williams@redhat.com>2012-03-13 12:39:48 -0500
commitf3fbe4626c25f9ba73b0decf8cc22dbddd37370c (patch)
tree6b321c6f59236edbc93cb7319270deae9e34f332 /mm/memory.c
parenta0067ed23ad0e7970bb2bb55dc0a11127a34a82e (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>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 829d43735402..52e3f6502b50 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3436,6 +3436,35 @@ unlock:
return 0;
}
+void pagefault_disable(void)
+{
+ inc_preempt_count();
+ current->pagefault_disabled++;
+ /*
+ * make sure to have issued the store before a pagefault
+ * can hit.
+ */
+ barrier();
+}
+EXPORT_SYMBOL_GPL(pagefault_disable);
+
+void pagefault_enable(void)
+{
+ /*
+ * make sure to issue those last loads/stores before enabling
+ * the pagefault handler again.
+ */
+ barrier();
+ current->pagefault_disabled--;
+ dec_preempt_count();
+ /*
+ * make sure we do..
+ */
+ barrier();
+ preempt_check_resched();
+}
+EXPORT_SYMBOL_GPL(pagefault_enable);
+
/*
* By the time we get here, we already hold the mm semaphore
*/