path: root/kernel/fork.c
diff options
authorDavid Hildenbrand <>2015-05-11 17:52:06 +0200
committerIngo Molnar <>2015-05-19 08:39:13 +0200
commit8bcbde5480f9777f8b74d71493722c663e22c21b (patch)
tree27f50af6fb09789e5b9310ff8aa16784bf9815ae /kernel/fork.c
parent3e51f3c4004c9b01f66da03214a3e206f5ed627b (diff)
sched/preempt, mm/fault: Count pagefault_disable() levels in pagefault_disabled
Until now, pagefault_disable()/pagefault_enabled() used the preempt count to track whether in an environment with pagefaults disabled (can be queried via in_atomic()). This patch introduces a separate counter in task_struct to count the level of pagefault_disable() calls. We'll keep manipulating the preempt count to retain compatibility to existing pagefault handlers. It is now possible to verify whether in a pagefault_disable() envionment by calling pagefault_disabled(). In contrast to in_atomic() it will not be influenced by preempt_enable()/preempt_disable(). This patch is based on a patch from Ingo Molnar. Reviewed-and-tested-by: Thomas Gleixner <> Signed-off-by: David Hildenbrand <> Signed-off-by: Peter Zijlstra (Intel) <> Cc: David.Laight@ACULAB.COM Cc: Linus Torvalds <> Cc: Peter Zijlstra <> Cc: Thomas Gleixner <> Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Link: Signed-off-by: Ingo Molnar <>
Diffstat (limited to 'kernel/fork.c')
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 2e670864174f..0bb88b555550 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1393,6 +1393,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
p->hardirq_context = 0;
p->softirq_context = 0;
+ p->pagefault_disabled = 0;
p->lockdep_depth = 0; /* no locks held yet */
p->curr_chain_key = 0;