diff options
author | Gautham R Shenoy <ego@in.ibm.com> | 2008-09-06 05:20:23 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-06 10:53:34 -0400 |
commit | 38736f475071b80b66be28af7b44c854073699cc (patch) | |
tree | 853b00d9fcf27093f75dbfe7d38922792c2c1a04 /kernel/sched_fair.c | |
parent | 7f79d852ed30a06eebf7497afe9334a726db3d40 (diff) |
sched: fix __load_balance_iterator() for cfq with only one task
The __load_balance_iterator() returns a NULL when there's only one
sched_entity which is a task. It is caused by the following code-path.
/* Skip over entities that are not tasks */
do {
se = list_entry(next, struct sched_entity, group_node);
next = next->next;
} while (next != &cfs_rq->tasks && !entity_is_task(se));
if (next == &cfs_rq->tasks)
return NULL;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This will return NULL even when se is a task.
As a side-effect, there was a regression in sched_mc behavior since 2.6.25,
since iter_move_one_task() when it calls load_balance_start_fair(),
would not get any tasks to move!
Fix this by checking if the last entity was a task or not.
Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r-- | kernel/sched_fair.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 8264bb5dbd51..a10ac0bcee64 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -1458,7 +1458,7 @@ __load_balance_iterator(struct cfs_rq *cfs_rq, struct list_head *next) | |||
1458 | next = next->next; | 1458 | next = next->next; |
1459 | } while (next != &cfs_rq->tasks && !entity_is_task(se)); | 1459 | } while (next != &cfs_rq->tasks && !entity_is_task(se)); |
1460 | 1460 | ||
1461 | if (next == &cfs_rq->tasks) | 1461 | if (next == &cfs_rq->tasks && !entity_is_task(se)) |
1462 | return NULL; | 1462 | return NULL; |
1463 | 1463 | ||
1464 | cfs_rq->balance_iterator = next; | 1464 | cfs_rq->balance_iterator = next; |