aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2014-01-15 10:33:20 -0500
committerIngo Molnar <mingo@kernel.org>2014-01-16 03:27:15 -0500
commit39fd8fd22b3224ec6819d33b3e34ae4da6a35f05 (patch)
tree89d90224b682be4aa979465d52d06263b179a98f
parente3de300d1212b42aa9d0d6031b12fca06ac00dd9 (diff)
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@intel.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: Juri Lelli <juri.lelli@gmail.com> Cc: Dario Faggioli <raistlin@linux.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@kernel.org>
-rw-r--r--kernel/sched/core.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c1b3d7e04f0f..e9212eb354b8 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,
3172{ 3172{
3173 int policy = attr->sched_policy; 3173 int policy = attr->sched_policy;
3174 3174
3175 if (policy == -1) /* setparam */
3176 policy = p->policy;
3177
3175 p->policy = policy; 3178 p->policy = policy;
3176 3179
3177 if (dl_policy(policy)) 3180 if (dl_policy(policy))
3178 __setparam_dl(p, attr); 3181 __setparam_dl(p, attr);
3179 else if (rt_policy(policy)) 3182 else if (fair_policy(policy))
3180 p->rt_priority = attr->sched_priority;
3181 else
3182 p->static_prio = NICE_TO_PRIO(attr->sched_nice); 3183 p->static_prio = NICE_TO_PRIO(attr->sched_nice);
3183 3184
3185 /*
3186 * __sched_setscheduler() ensures attr->sched_priority == 0 when
3187 * !rt_policy. Always setting this ensures that things like
3188 * getparam()/getattr() don't report silly values for !rt tasks.
3189 */
3190 p->rt_priority = attr->sched_priority;
3191
3184 p->normal_prio = normal_prio(p); 3192 p->normal_prio = normal_prio(p);
3185 p->prio = rt_mutex_getprio(p); 3193 p->prio = rt_mutex_getprio(p);
3186 3194