[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-39fd8fd22b3224ec6819d33b3e34ae4da6a35f05@git.kernel.org>
Date: Thu, 16 Jan 2014 05:40:30 -0800
From: tip-bot for Peter Zijlstra <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...nel.org,
peterz@...radead.org, raistlin@...ux.it, tglx@...utronix.de,
fengguang.wu@...el.com, juri.lelli@...il.com
Subject: [tip:sched/core] sched: Fix up scheduler syscall LTP fails
Commit-ID: 39fd8fd22b3224ec6819d33b3e34ae4da6a35f05
Gitweb: http://git.kernel.org/tip/39fd8fd22b3224ec6819d33b3e34ae4da6a35f05
Author: Peter Zijlstra <peterz@...radead.org>
AuthorDate: Wed, 15 Jan 2014 16:33:20 +0100
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Thu, 16 Jan 2014 09:27:15 +0100
sched: Fix up scheduler syscall LTP fails
Wu reported LTP failures:
> ltp.sched_setparam02.1.TFAIL
> ltp.sched_setparam02.2.TFAIL
> ltp.sched_setparam02.3.TFAIL
> ltp.sched_setparam03.1.TFAIL
There were 2 things wrong; firstly __setscheduler() failed on
sched_setparam()'s policy = -1, fix that by reading from p->policy in
that case.
Secondly, getparam() (and getattr()) would still report !0
sched_priority for !FIFO/RR tasks after having been such. So
unconditionally set p->rt_priority.
Reported-by: Fengguang Wu <fengguang.wu@...el.com>
Signed-off-by: Peter Zijlstra <peterz@...radead.org>
Cc: Juri Lelli <juri.lelli@...il.com>
Cc: Dario Faggioli <raistlin@...ux.it>
Fixes: d50dde5a10f3 ("sched: Add new scheduler syscalls to support an extended scheduling parameters ABI")
Link: http://lkml.kernel.org/r/20140115153320.GH31570@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
kernel/sched/core.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c1b3d7e..e9212eb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3172,15 +3172,23 @@ static void __setscheduler(struct rq *rq, struct task_struct *p,
{
int policy = attr->sched_policy;
+ if (policy == -1) /* setparam */
+ policy = p->policy;
+
p->policy = policy;
if (dl_policy(policy))
__setparam_dl(p, attr);
- else if (rt_policy(policy))
- p->rt_priority = attr->sched_priority;
- else
+ else if (fair_policy(policy))
p->static_prio = NICE_TO_PRIO(attr->sched_nice);
+ /*
+ * __sched_setscheduler() ensures attr->sched_priority == 0 when
+ * !rt_policy. Always setting this ensures that things like
+ * getparam()/getattr() don't report silly values for !rt tasks.
+ */
+ p->rt_priority = attr->sched_priority;
+
p->normal_prio = normal_prio(p);
p->prio = rt_mutex_getprio(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