Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d299f1b authored by Gregory Haskins's avatar Gregory Haskins Committed by Ingo Molnar
Browse files

sched: fix SCHED_OTHER balance iterator to include all tasks



The currently logic inadvertently skips the last task on the run-queue,
resulting in missed balance opportunities.

Signed-off-by: default avatarGregory Haskins <ghaskins@novell.com>
Signed-off-by: default avatarDavid Bahi <dbahi@novell.com>
CC: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 6e0534f2
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -1275,23 +1275,18 @@ __load_balance_iterator(struct cfs_rq *cfs_rq, struct list_head *next)
	struct task_struct *p = NULL;
	struct sched_entity *se;

	if (next == &cfs_rq->tasks)
		return NULL;

	/* Skip over entities that are not tasks */
	do {
	while (next != &cfs_rq->tasks) {
		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;

	cfs_rq->balance_iterator = next;

	if (entity_is_task(se))
		/* Skip over entities that are not tasks */
		if (entity_is_task(se)) {
			p = task_of(se);
			break;
		}
	}

	cfs_rq->balance_iterator = next;
	return p;
}