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]
Message-ID: <BANLkTint_00+oHVGpgV4n4E2A9W5O8nJxA@mail.gmail.com>
Date:	Sun, 5 Jun 2011 17:54:04 +0800
From:	Hillf Danton <dhillf@...il.com>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	Steven Rostedt <rostedt@...dmis.org>,
	Mike Galbraith <efault@....de>,
	Yong Zhang <yong.zhang0@...il.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...e.hu>
Subject: [PATCH] sched: update cpupri for runqueue when its priority changes

When the priority of runqueue changes, lower or higer, the info of cpupri
should be updated, in cases such as pick_next_task_rt() and switched_to_rt().

Signed-off-by: Hillf Danton <dhillf@...il.com>
---
 kernel/sched_rt.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 08e9374..9508168 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1158,6 +1158,8 @@ static struct task_struct
*pick_next_task_rt(struct rq *rq)
 	 * lock again later if there is no need to push
 	 */
 	rq->post_schedule = has_pushable_tasks(rq);
+
+	cpupri_set(&rq->rd->cpupri, rq->cpu, p == NULL ? MAX_RT_PRIO : p->prio);
 #endif

 	return p;
@@ -1673,6 +1675,8 @@ static void switched_to_rt(struct rq *rq, struct
task_struct *p)
 {
 	int check_resched = 1;

+	if (!p->on_rq)
+		return;
 	/*
 	 * If we are already running, then there's nothing
 	 * that needs to be done. But if we are not running
@@ -1680,7 +1684,7 @@ static void switched_to_rt(struct rq *rq, struct
task_struct *p)
 	 * If that current running task is also an RT task
 	 * then see if we can move to another run queue.
 	 */
-	if (p->on_rq && rq->curr != p) {
+	if (rq->curr != p) {
 #ifdef CONFIG_SMP
 		if (rq->rt.overloaded && push_rt_task(rq) &&
 		    /* Don't resched if we changed runqueues */
@@ -1690,6 +1694,11 @@ static void switched_to_rt(struct rq *rq,
struct task_struct *p)
 		if (check_resched && p->prio < rq->curr->prio)
 			resched_task(rq->curr);
 	}
+	else {
+#ifdef CONFIG_SMP
+		cpupri_set(&rq->rd->cpupri, rq->cpu, p->prio);
+#endif
+	}
 }

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