]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.fixes/sched-fix-__load_balance_iterator-for-cfs-with-on.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / sched-fix-__load_balance_iterator-for-cfs-with-on.patch
diff --git a/src/patches/suse-2.6.27.31/patches.fixes/sched-fix-__load_balance_iterator-for-cfs-with-on.patch b/src/patches/suse-2.6.27.31/patches.fixes/sched-fix-__load_balance_iterator-for-cfs-with-on.patch
new file mode 100644 (file)
index 0000000..198b0b9
--- /dev/null
@@ -0,0 +1,43 @@
+Subject: fix __load_balance_iterator() for cfs with only one task
+From: Gautham R Shenoy <ego@in.ibm.com>
+References: 457594 - LTC50544
+
+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>
+Signed-off-by: Olaf Hering <olh@suse.de>
+---
+ kernel/sched_fair.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/sched_fair.c
++++ b/kernel/sched_fair.c
+@@ -1410,7 +1410,7 @@ __load_balance_iterator(struct cfs_rq *c
+               next = next->next;
+       } while (next != &cfs_rq->tasks && !entity_is_task(se));
+-      if (next == &cfs_rq->tasks)
++      if (next == &cfs_rq->tasks && !entity_is_task(se))
+               return NULL;
+       cfs_rq->balance_iterator = next;