aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 0c8712630f05..f3030709d826 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4981,12 +4981,15 @@ recheck:
4981 param->sched_priority > rlim_rtprio) 4981 param->sched_priority > rlim_rtprio)
4982 return -EPERM; 4982 return -EPERM;
4983 } 4983 }
4984
4984 /* 4985 /*
4985 * Like positive nice levels, dont allow tasks to 4986 * Treat SCHED_IDLE as nice 20. Only allow a switch to
4986 * move out of SCHED_IDLE either: 4987 * SCHED_NORMAL if the RLIMIT_NICE would normally permit it.
4987 */ 4988 */
4988 if (p->policy == SCHED_IDLE && policy != SCHED_IDLE) 4989 if (p->policy == SCHED_IDLE && policy != SCHED_IDLE) {
4989 return -EPERM; 4990 if (!can_nice(p, TASK_NICE(p)))
4991 return -EPERM;
4992 }
4990 4993
4991 /* can't change other user's priorities */ 4994 /* can't change other user's priorities */
4992 if (!check_same_owner(p)) 4995 if (!check_same_owner(p))