]> git.karo-electronics.de Git - linux-beck.git/commitdiff
sched: Replace hardcoding of -20 and 19 with MIN_NICE and MAX_NICE
authorDongsheng Yang <yangds.fnst@cn.fujitsu.com>
Tue, 11 Feb 2014 07:34:50 +0000 (15:34 +0800)
committerIngo Molnar <mingo@kernel.org>
Sat, 22 Feb 2014 17:15:54 +0000 (18:15 +0100)
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/bd80780f19b4f9b4a765acc353c8dbc130274dd6.1392103744.git.yangds.fnst@cn.fujitsu.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/auto_group.c
kernel/sched/core.c

index 4a073539c58e69992ed2133a73444ceffc9cd3fa..e73efba98301f77715c5e5e17b8e65a98bbb3769 100644 (file)
@@ -203,7 +203,7 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int nice)
        struct autogroup *ag;
        int err;
 
-       if (nice < -20 || nice > 19)
+       if (nice < MIN_NICE || nice > MAX_NICE)
                return -EINVAL;
 
        err = security_task_setnice(current, nice);
index cc4965e969b11d5c764cc7a8db4574e3a484e083..a8a73b8897bf91a0b983d542b00c4a94b96ce9bc 100644 (file)
@@ -2993,7 +2993,7 @@ void set_user_nice(struct task_struct *p, long nice)
        unsigned long flags;
        struct rq *rq;
 
-       if (task_nice(p) == nice || nice < -20 || nice > 19)
+       if (task_nice(p) == nice || nice < MIN_NICE || nice > MAX_NICE)
                return;
        /*
         * We have to be careful, if called from sys_setpriority(),
@@ -3072,10 +3072,10 @@ SYSCALL_DEFINE1(nice, int, increment)
                increment = 40;
 
        nice = task_nice(current) + increment;
-       if (nice < -20)
-               nice = -20;
-       if (nice > 19)
-               nice = 19;
+       if (nice < MIN_NICE)
+               nice = MIN_NICE;
+       if (nice > MAX_NICE)
+               nice = MAX_NICE;
 
        if (increment < 0 && !can_nice(current, nice))
                return -EPERM;
@@ -3623,7 +3623,7 @@ static int sched_copy_attr(struct sched_attr __user *uattr,
         * XXX: do we want to be lenient like existing syscalls; or do we want
         * to be strict and return an error on out-of-bounds values?
         */
-       attr->sched_nice = clamp(attr->sched_nice, -20, 19);
+       attr->sched_nice = clamp(attr->sched_nice, MIN_NICE, MAX_NICE);
 
 out:
        return ret;