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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 23 Sep 2009 08:32:59 +0200
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Peter Williams <pwil3058@...pond.net.au>
Cc:	Ingo Molnar <mingo@...e.hu>, Mike Galbraith <efault@....de>,
	Linux Kernel Mailing <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sched: Make sure task has correct sched_class after
 policy change

On Wed, 2009-09-23 at 02:21 +0000, Peter Williams wrote:
> From the code in rt_mutex_setprio(), it is evident that the intention
> is that task's with a RT 'prio' value as a consequence of receiving a PI
> boost also have their 'sched_class' field set to '&rt_sched_class'.
> However, the code in __setscheduler() could result in this intention
> being frustrated.
> 
> This patch fixes this problem.
> 
> Signed-off-by: Peter Williams <pwil3058@...pond.net.au>

I think you're right, but the problem seems to be that it sets
sched_class based on policy, which seems fragile in the face of PI.

How about the alternative below?

---
 kernel/sched.c |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 91843ba..753a52c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6129,23 +6129,14 @@ __setscheduler(struct rq *rq, struct task_struct *p, int policy, int prio)
 {
 	BUG_ON(p->se.on_rq);
 
-	p->policy = policy;
-	switch (p->policy) {
-	case SCHED_NORMAL:
-	case SCHED_BATCH:
-	case SCHED_IDLE:
-		p->sched_class = &fair_sched_class;
-		break;
-	case SCHED_FIFO:
-	case SCHED_RR:
-		p->sched_class = &rt_sched_class;
-		break;
-	}
-
 	p->rt_priority = prio;
 	p->normal_prio = normal_prio(p);
 	/* we are holding p->pi_lock already */
 	p->prio = rt_mutex_getprio(p);
+	if (rt_prio(p->prio))
+		p->sched_class = &rt_sched_class;
+	else
+		p->sched_class = &fair_sched_class;
 	set_load_weight(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