aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched/core.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9e126a21c5c7..ae365aaa8181 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3195,6 +3195,7 @@ static void __setscheduler_params(struct task_struct *p,
3195 * getparam()/getattr() don't report silly values for !rt tasks. 3195 * getparam()/getattr() don't report silly values for !rt tasks.
3196 */ 3196 */
3197 p->rt_priority = attr->sched_priority; 3197 p->rt_priority = attr->sched_priority;
3198 p->normal_prio = normal_prio(p);
3198 set_load_weight(p); 3199 set_load_weight(p);
3199} 3200}
3200 3201
@@ -3204,6 +3205,12 @@ static void __setscheduler(struct rq *rq, struct task_struct *p,
3204{ 3205{
3205 __setscheduler_params(p, attr); 3206 __setscheduler_params(p, attr);
3206 3207
3208 /*
3209 * If we get here, there was no pi waiters boosting the
3210 * task. It is safe to use the normal prio.
3211 */
3212 p->prio = normal_prio(p);
3213
3207 if (dl_prio(p->prio)) 3214 if (dl_prio(p->prio))
3208 p->sched_class = &dl_sched_class; 3215 p->sched_class = &dl_sched_class;
3209 else if (rt_prio(p->prio)) 3216 else if (rt_prio(p->prio))
@@ -3262,7 +3269,8 @@ static int __sched_setscheduler(struct task_struct *p,
3262 const struct sched_attr *attr, 3269 const struct sched_attr *attr,
3263 bool user) 3270 bool user)
3264{ 3271{
3265 int newprio = MAX_RT_PRIO - 1 - attr->sched_priority; 3272 int newprio = dl_policy(attr->sched_policy) ? MAX_DL_PRIO - 1 :
3273 MAX_RT_PRIO - 1 - attr->sched_priority;
3266 int retval, oldprio, oldpolicy = -1, on_rq, running; 3274 int retval, oldprio, oldpolicy = -1, on_rq, running;
3267 int policy = attr->sched_policy; 3275 int policy = attr->sched_policy;
3268 unsigned long flags; 3276 unsigned long flags;