diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-01-18 18:30:21 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-01-18 18:30:21 -0800 |
| commit | ea9c300dbdc3bb6417969ac6e65459567cfda8ce (patch) | |
| tree | 0e5b1ad579dc952f81dc33a0acec80de6d1f9295 | |
| parent | 67006113bec9bbe326f9e862295183182115e5fb (diff) | |
[PATCH] can_migrate_task cleanup
From: Ingo Molnar <mingo@elte.hu>
- minor can_migrate_task cleanup
| -rw-r--r-- | kernel/sched.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 0e2b65cffa52..bf56c3cc980e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1147,25 +1147,25 @@ static inline void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t } /* - * Previously: - * - * #define CAN_MIGRATE_TASK(p,rq,this_cpu) \ - * ((!idle || (NS_TO_JIFFIES(now - (p)->timestamp) > \ - * cache_decay_ticks)) && !task_running(rq, p) && \ - * cpu_isset(this_cpu, (p)->cpus_allowed)) + * can_migrate_task - may task p from runqueue rq be migrated to this_cpu? */ - static inline int can_migrate_task(task_t *tsk, runqueue_t *rq, int this_cpu, int idle) { unsigned long delta = rq->timestamp_last_tick - tsk->timestamp; - if (!idle && (delta <= JIFFIES_TO_NS(cache_decay_ticks))) - return 0; + /* + * We do not migrate tasks that are: + * 1) running (obviously), or + * 2) cannot be migrated to this CPU due to cpus_allowed, or + * 3) are cache-hot on their current CPU. + */ if (task_running(rq, tsk)) return 0; if (!cpu_isset(this_cpu, tsk->cpus_allowed)) return 0; + if (!idle && (delta <= JIFFIES_TO_NS(cache_decay_ticks))) + return 0; return 1; } @@ -1227,13 +1227,6 @@ skip_bitmap: skip_queue: tmp = list_entry(curr, task_t, run_list); - /* - * We do not migrate tasks that are: - * 1) running (obviously), or - * 2) cannot be migrated to this CPU due to cpus_allowed, or - * 3) are cache-hot on their current CPU. - */ - curr = curr->prev; if (!can_migrate_task(tmp, busiest, this_cpu, idle)) { @@ -1243,6 +1236,8 @@ skip_queue: goto skip_bitmap; } pull_task(busiest, array, tmp, this_rq, this_cpu); + + /* Only migrate one task if we are idle */ if (!idle && --imbalance) { if (curr != head) goto skip_queue; |
