summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-06-16 11:26:08 (GMT)
committerScott Wood <scottwood@freescale.com>2015-02-13 22:20:35 (GMT)
commit2e61bae2d666e1eea7d367b5b0b7b932ee573c29 (patch)
treeaf875940ab205cec4179f94c9bd3728d58bc57e1 /include
parentfda46064abe2b94faafa5db1d6d66d97f006ae85 (diff)
downloadlinux-fsl-qoriq-2e61bae2d666e1eea7d367b5b0b7b932ee573c29.tar.xz
sched-migrate-disable.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/preempt.h8
-rw-r--r--include/linux/sched.h13
2 files changed, 18 insertions, 3 deletions
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index f237ebd..fbf934b 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -130,6 +130,14 @@ do { \
#endif /* CONFIG_PREEMPT_COUNT */
+#ifdef CONFIG_SMP
+extern void migrate_disable(void);
+extern void migrate_enable(void);
+#else
+# define migrate_disable() barrier()
+# define migrate_enable() barrier()
+#endif
+
#ifdef CONFIG_PREEMPT_RT_FULL
# define preempt_disable_rt() preempt_disable()
# define preempt_enable_rt() preempt_enable()
diff --git a/include/linux/sched.h b/include/linux/sched.h
index a32ddf5..130b47c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1068,6 +1068,7 @@ struct task_struct {
#endif
unsigned int policy;
+ int migrate_disable;
int nr_cpus_allowed;
cpumask_t cpus_allowed;
@@ -1445,9 +1446,6 @@ struct task_struct {
#endif
};
-/* Future-safe accessor for struct task_struct's cpus_allowed. */
-#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
-
#ifdef CONFIG_NUMA_BALANCING
extern void task_numa_fault(int node, int pages, bool migrated);
extern void set_numabalancing_state(bool enabled);
@@ -2773,6 +2771,15 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
#endif /* CONFIG_SMP */
+/* Future-safe accessor for struct task_struct's cpus_allowed. */
+static inline const struct cpumask *tsk_cpus_allowed(struct task_struct *p)
+{
+ if (p->migrate_disable)
+ return cpumask_of(task_cpu(p));
+
+ return &p->cpus_allowed;
+}
+
extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
extern long sched_getaffinity(pid_t pid, struct cpumask *mask);