diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-08-11 13:31:31 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2013-04-04 22:09:09 (GMT) |
commit | e580ed044d1d9ee7b4e5e4f26c04f3dbf1b49ea8 (patch) | |
tree | a8025669c64973a7958e64b58cc23ef401374ae5 /include/linux | |
parent | 1aebc993d201dd35eb834e5171caef7400a323ff (diff) | |
download | linux-fsl-qoriq-e580ed044d1d9ee7b4e5e4f26c04f3dbf1b49ea8.tar.xz |
mm: pagefault_disabled()
Wrap the test for pagefault_disabled() into a helper, this allows us
to remove the need for current->pagefault_disabled on !-rt kernels.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-3yy517m8zsi9fpsf14xfaqkw@git.kernel.org
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/sched.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 3fb5915..fd868f6 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -51,6 +51,7 @@ struct sched_param { #include <linux/cred.h> #include <linux/llist.h> #include <linux/uidgid.h> +#include <linux/hardirq.h> #include <asm/processor.h> @@ -1452,7 +1453,9 @@ struct task_struct { /* mutex deadlock detection */ struct mutex_waiter *blocked_on; #endif +#ifdef CONFIG_PREEMPT_RT_FULL int pagefault_disabled; +#endif #ifdef CONFIG_TRACE_IRQFLAGS unsigned int irq_events; unsigned long hardirq_enable_ip; @@ -1628,6 +1631,17 @@ static inline void set_numabalancing_state(bool enabled) } #endif +#ifdef CONFIG_PREEMPT_RT_FULL +static inline bool cur_pf_disabled(void) { return current->pagefault_disabled; } +#else +static inline bool cur_pf_disabled(void) { return false; } +#endif + +static inline bool pagefault_disabled(void) +{ + return in_atomic() || cur_pf_disabled(); +} + /* * Priority of a process goes from 0..MAX_PRIO-1, valid RT * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH |