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:	Sat, 02 Jul 2011 00:41:51 +0600
From:	Rakib Mullick <rakib.mullick@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH] sched: Check nr_running before calling pick_next_task in
 schedule().

Currently at schedule(), when we call pick_next_task we don't check whether current rq is empty or not. Since idle_balance can fail,
its nice to check whether we really have any task on rq or not. If not, we can call idle_sched_class.pick_next_task straight.

Signed-off-by: Rakib Mullick <rakib.mullick@...il.com>
---

diff --git a/kernel/sched.c b/kernel/sched.c
index 5925275..a4f4f58 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4273,7 +4273,14 @@ need_resched:
 		idle_balance(cpu, rq);
 
 	put_prev_task(rq, prev);
-	next = pick_next_task(rq);
+	/*  Since idle_balance can fail, its better to check rq->nr_running.
+	 *  Otherwise we can call idle_sched_class.pick_next_task straight,
+	 *  cause we need to do some accounting.
+	 */
+	if (likely(rq->nr_running))
+		next = pick_next_task(rq);
+	else
+		next = idle_sched_class.pick_next_task(rq);
 	clear_tsk_need_resched(prev);
 	rq->skip_clock_update = 0;
 


--
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