]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.fixes/sched-fix-__load_balance_iterator-for-cfs-with-on.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / sched-fix-__load_balance_iterator-for-cfs-with-on.patch
1 Subject: fix __load_balance_iterator() for cfs with only one task
2 From: Gautham R Shenoy <ego@in.ibm.com>
3 References: 457594 - LTC50544
4
5 The __load_balance_iterator() returns a NULL when there's only one
6 sched_entity which is a task. It is caused by the following code-path.
7
8 /* Skip over entities that are not tasks */
9 do {
10 se = list_entry(next, struct sched_entity, group_node);
11 next = next->next;
12 } while (next != &cfs_rq->tasks && !entity_is_task(se));
13
14 if (next == &cfs_rq->tasks)
15 return NULL;
16 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 This will return NULL even when se is a task.
18
19 As a side-effect, there was a regression in sched_mc behavior since 2.6.25,
20 since iter_move_one_task() when it calls load_balance_start_fair(),
21 would not get any tasks to move!
22
23 Fix this by checking if the last entity was a task or not.
24
25 Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
26 Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
27 Signed-off-by: Ingo Molnar <mingo@elte.hu>
28 Signed-off-by: Olaf Hering <olh@suse.de>
29 ---
30 kernel/sched_fair.c | 2 +-
31 1 file changed, 1 insertion(+), 1 deletion(-)
32
33 --- a/kernel/sched_fair.c
34 +++ b/kernel/sched_fair.c
35 @@ -1410,7 +1410,7 @@ __load_balance_iterator(struct cfs_rq *c
36 next = next->next;
37 } while (next != &cfs_rq->tasks && !entity_is_task(se));
38
39 - if (next == &cfs_rq->tasks)
40 + if (next == &cfs_rq->tasks && !entity_is_task(se))
41 return NULL;
42
43 cfs_rq->balance_iterator = next;