lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 05 May 2008 08:31:22 -0600
From:	Gregory Haskins <ghaskins@...ell.com>
To:	mingo@...e.hu, peterz@...radead.org
Cc:	linux-kernel@...r.kernel.org,
	Gregory Haskins <ghaskins@...ell.com>,
	David Bahi <dbahi@...ell.com>, Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>
Subject: [PATCH] sched: fix SCHED_OTHER balance iterator to include all tasks

Hi Ingo,
 The follow patch applies to sched-devel.  I know the original function was
 somehow trying to protect against dequeueing by pre-iterating.  I am not sure
 if I captured the intent properly in that regard.  What I can say is that the
 old algorithm would miss tasks, and that is now fixed.  It may need further
 adjustment if I missed the pre-iterating operation.

Hi Peter,
 I was wrong earlier when I mentioned there might be a problem with
 entity_is_task().  I think this was the root cause of what I was seeing.
 Sorry for the red-herring.

Regards,
-Greg

-----------------------
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: Gregory Haskins <ghaskins@...ell.com>
Signed-off-by: David Bahi <dbahi@...ell.com>
CC: Ingo Molnar <mingo@...e.hu>
CC: Peter Zijlstra <peterz@...radead.org>
---

 kernel/sched_fair.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 87b7300..e8c289a 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1700,23 +1700,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;
+		/* Skip over entities that are not tasks */
+		if (entity_is_task(se)) {
+			p = task_of(se);
+			break;
+		}
+	}
 
 	cfs_rq->balance_iterator = next;
-
-	if (entity_is_task(se))
-		p = task_of(se);
-
 	return p;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ