diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-08-11 13:14:58 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-05-14 18:38:17 (GMT) |
commit | 7f751a4b1b96d1622b413400008d5a59f59cdc85 (patch) | |
tree | 61e9d35a5fc747a99aaefefa775aca86e2da45b1 /include/linux/sched.h | |
parent | 852966311c98b98674d1c5c6fbbbbb28bd71d2cb (diff) | |
download | linux-fsl-qoriq-7f751a4b1b96d1622b413400008d5a59f59cdc85.tar.xz |
sched: Generic migrate_disable
Make migrate_disable() be a preempt_disable() for !rt kernels. This
allows generic code to use it but still enforces that these code
sections stay relatively small.
A preemptible migrate_disable() accessible for general use would allow
people growing arbitrary per-cpu crap instead of clean these things
up.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-275i87sl8e1jcamtchmehonm@git.kernel.org
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 9861c9b..9ef7bee 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1063,7 +1063,9 @@ struct task_struct { #endif unsigned int policy; +#ifdef CONFIG_PREEMPT_RT_FULL int migrate_disable; +#endif int nr_cpus_allowed; cpumask_t cpus_allowed; @@ -2732,11 +2734,22 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) #endif /* CONFIG_SMP */ +static inline int __migrate_disabled(struct task_struct *p) +{ +#ifdef CONFIG_PREEMPT_RT_FULL + return p->migrate_disable; +#else + return 0; +#endif +} + /* Future-safe accessor for struct task_struct's cpus_allowed. */ static inline const struct cpumask *tsk_cpus_allowed(struct task_struct *p) { +#ifdef CONFIG_PREEMPT_RT_FULL if (p->migrate_disable) return cpumask_of(task_cpu(p)); +#endif return &p->cpus_allowed; } |