diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-04-05 11:23:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-04-14 02:52:41 -0400 |
commit | bd8e7dded88a3e1c085c333f19ff31387616f71a (patch) | |
tree | 3dc947138fd33416b53411244de5d6c9dc08a5fa /kernel/sched.c | |
parent | 317f394160e9beb97d19a84c39b7e5eb3d7815a8 (diff) |
sched: Remove need_migrate_task()
Oleg noticed that need_migrate_task() doesn't need the ->on_cpu check
now that ttwu() doesn't do remote enqueues for !->on_rq && ->on_cpu,
so remove the helper and replace the single instance with a direct
->on_rq test.
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20110405152729.556674812@chello.nl
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 9e3ede120e81..cd597c7442a3 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2199,21 +2199,6 @@ struct migration_arg { | |||
2199 | static int migration_cpu_stop(void *data); | 2199 | static int migration_cpu_stop(void *data); |
2200 | 2200 | ||
2201 | /* | 2201 | /* |
2202 | * The task's runqueue lock must be held. | ||
2203 | * Returns true if you have to wait for migration thread. | ||
2204 | */ | ||
2205 | static bool need_migrate_task(struct task_struct *p) | ||
2206 | { | ||
2207 | /* | ||
2208 | * If the task is not on a runqueue (and not running), then | ||
2209 | * the next wake-up will properly place the task. | ||
2210 | */ | ||
2211 | bool running = p->on_rq || p->on_cpu; | ||
2212 | smp_rmb(); /* finish_lock_switch() */ | ||
2213 | return running; | ||
2214 | } | ||
2215 | |||
2216 | /* | ||
2217 | * wait_task_inactive - wait for a thread to unschedule. | 2202 | * wait_task_inactive - wait for a thread to unschedule. |
2218 | * | 2203 | * |
2219 | * If @match_state is nonzero, it's the @p->state value just checked and | 2204 | * If @match_state is nonzero, it's the @p->state value just checked and |
@@ -5985,7 +5970,7 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask) | |||
5985 | goto out; | 5970 | goto out; |
5986 | 5971 | ||
5987 | dest_cpu = cpumask_any_and(cpu_active_mask, new_mask); | 5972 | dest_cpu = cpumask_any_and(cpu_active_mask, new_mask); |
5988 | if (need_migrate_task(p)) { | 5973 | if (p->on_rq) { |
5989 | struct migration_arg arg = { p, dest_cpu }; | 5974 | struct migration_arg arg = { p, dest_cpu }; |
5990 | /* Need help from migration thread: drop lock and wait. */ | 5975 | /* Need help from migration thread: drop lock and wait. */ |
5991 | task_rq_unlock(rq, p, &flags); | 5976 | task_rq_unlock(rq, p, &flags); |