|
@@ -4981,12 +4981,15 @@ static int __sched_setscheduler(struct task_struct *p, int policy,
|
|
|
param->sched_priority > rlim_rtprio)
|
|
param->sched_priority > rlim_rtprio)
|
|
|
return -EPERM;
|
|
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 */
|
|
/* can't change other user's priorities */
|
|
|
if (!check_same_owner(p))
|
|
if (!check_same_owner(p))
|