diff --git a/kernel/sched.c b/kernel/sched.c index f592ce6f861624857597199920bc5a12900136a7..a8845516ace6a446a8a0618c3f3d2a728e9ab36b 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -5011,6 +5011,17 @@ static int __sched_setscheduler(struct task_struct *p, int policy, return -EINVAL; } + /* + * If not changing anything there's no need to proceed further: + */ + if (unlikely(policy == p->policy && (!rt_policy(policy) || + param->sched_priority == p->rt_priority))) { + + __task_rq_unlock(rq); + raw_spin_unlock_irqrestore(&p->pi_lock, flags); + return 0; + } + #ifdef CONFIG_RT_GROUP_SCHED if (user) { /*