summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2011-08-11 15:14:58 +0200
committerClark Williams <williams@redhat.com>2012-02-15 10:32:50 -0600
commit4744b0dbe16c0a8195b825316b21b83d706efbff (patch)
tree887ef7e210114fceef34bacecbae03d7a26f57f9 /kernel
parentdce5b35c195cf474a34e93d101cc1420eb285f51 (diff)
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 'kernel')
-rw-r--r--kernel/sched.c6
-rw-r--r--kernel/trace/trace.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index ebdf95d49ab2..eff6bbe2a4dd 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6224,7 +6224,7 @@ static inline void sched_init_granularity(void)
#ifdef CONFIG_SMP
void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
{
- if (!p->migrate_disable) {
+ if (!__migrate_disabled(p)) {
if (p->sched_class && p->sched_class->set_cpus_allowed)
p->sched_class->set_cpus_allowed(p, new_mask);
p->rt.nr_cpus_allowed = cpumask_weight(new_mask);
@@ -6280,7 +6280,7 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
do_set_cpus_allowed(p, new_mask);
/* Can the task run on the task's current CPU? If so, we're done */
- if (cpumask_test_cpu(task_cpu(p), new_mask) || p->migrate_disable)
+ if (cpumask_test_cpu(task_cpu(p), new_mask) || __migrate_disabled(p))
goto out;
dest_cpu = cpumask_any_and(cpu_active_mask, new_mask);
@@ -6299,6 +6299,7 @@ out:
}
EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr);
+#ifdef CONFIG_PREEMPT_RT_FULL
void migrate_disable(void)
{
struct task_struct *p = current;
@@ -6391,6 +6392,7 @@ void migrate_enable(void)
preempt_enable();
}
EXPORT_SYMBOL_GPL(migrate_enable);
+#endif /* CONFIG_PREEMPT_RT_FULL */
/*
* Move (not current) task off this cpu, onto dest cpu. We're doing
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 6a4df0bce134..26d9aaa741c2 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1124,7 +1124,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) |
(need_resched() ? TRACE_FLAG_NEED_RESCHED : 0);
- entry->migrate_disable = (tsk) ? tsk->migrate_disable & 0xFF : 0;
+ entry->migrate_disable = (tsk) ? __migrate_disabled(tsk) & 0xFF : 0;
}
EXPORT_SYMBOL_GPL(tracing_generic_entry_update);