aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-06-16 13:26:08 +0200
committerSteven Rostedt <rostedt@rostedt.homelinux.com>2013-05-20 13:46:15 -0400
commit1fb7b12d5b0022018e6ba04b22d2ab1e8f05ac2b (patch)
tree8e2ac1876438d5eb0793d8865a6393ca0a351485 /include
parent43eb9013d88b20921d1386cc4464891ef18b4342 (diff)
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
-rw-r--r--include/linux/smp.h1
3 files changed, 18 insertions, 4 deletions
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index d58f1585fef8..8547d22a2cad 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -114,6 +114,14 @@ do { \
#endif /* CONFIG_PREEMPT_COUNT */
+#ifdef CONFIG_SMP
+extern void migrate_disable(void);
+extern void migrate_enable(void);
+#else
+# define migrate_disable() do { } while (0)
+# define migrate_enable() do { } while (0)
+#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 be35c4420a59..1750a3c4a833 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1263,6 +1263,7 @@ struct task_struct {
#endif
unsigned int policy;
+ int migrate_disable;
cpumask_t cpus_allowed;
#ifdef CONFIG_PREEMPT_RCU
@@ -1602,9 +1603,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_PREEMPT_RT_FULL
static inline bool cur_pf_disabled(void) { return current->pagefault_disabled; }
#else
@@ -2704,6 +2702,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);
diff --git a/include/linux/smp.h b/include/linux/smp.h
index e6c58d8796b3..94c8430da063 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -80,7 +80,6 @@ void __smp_call_function_single(int cpuid, struct call_single_data *data,
int smp_call_function_any(const struct cpumask *mask,
smp_call_func_t func, void *info, int wait);
-
/*
* Generic and arch helpers
*/