diff --git a/[refs] b/[refs] index 5c736c40cc26..b55c5a3a0c48 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a2f5c9ab79f78e8b91ac993e0543d65b661dd19b +refs/heads/master: c02aa73b1d18e43cfd79c2f193b225e84ca497c8 diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index 0c8712630f05..f3030709d826 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -4981,12 +4981,15 @@ static int __sched_setscheduler(struct task_struct *p, int policy, param->sched_priority > rlim_rtprio) return -EPERM; } + /* - * Like positive nice levels, dont allow tasks to - * move out of SCHED_IDLE either: + * Treat SCHED_IDLE as nice 20. Only allow a switch to + * SCHED_NORMAL if the RLIMIT_NICE would normally permit it. */ - if (p->policy == SCHED_IDLE && policy != SCHED_IDLE) - return -EPERM; + if (p->policy == SCHED_IDLE && policy != SCHED_IDLE) { + if (!can_nice(p, TASK_NICE(p))) + return -EPERM; + } /* can't change other user's priorities */ if (!check_same_owner(p))