[PATCH] fix MAX_USER_RT_PRIO and MAX_RT_PRIO
authorSteven Rostedt <rostedt@goodmis.org>
Mon, 25 Jul 2005 20:28:39 +0000 (16:28 -0400)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Jul 2005 22:40:00 +0000 (15:40 -0700)
Here's the patch again to fix the code to handle if the values between
MAX_USER_RT_PRIO and MAX_RT_PRIO are different.

Without this patch, an SMP system will crash if the values are
different.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Dean Nelson <dcn@sgi.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ia64/sn/kernel/xpc_main.c
kernel/sched.c

index d580adcad927a15e316097e0422746db9bca408e..bb1d5cf30440cb9bf01b501084dd3ec08e8326ce 100644 (file)
@@ -420,7 +420,7 @@ xpc_activating(void *__partid)
        partid_t partid = (u64) __partid;
        struct xpc_partition *part = &xpc_partitions[partid];
        unsigned long irq_flags;
-       struct sched_param param = { sched_priority: MAX_USER_RT_PRIO - 1 };
+       struct sched_param param = { sched_priority: MAX_RT_PRIO - 1 };
        int ret;
 
 
index a5fb654ea59071015e6516392444fcc5d41b1153..a646e4f36c4136d49d3ba1444cc22133e21b4d92 100644 (file)
@@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_struct *p, int policy, int prio)
        p->policy = policy;
        p->rt_priority = prio;
        if (policy != SCHED_NORMAL)
-               p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority;
+               p->prio = MAX_RT_PRIO-1 - p->rt_priority;
        else
                p->prio = p->static_prio;
 }
@@ -3518,7 +3518,8 @@ recheck:
         * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0.
         */
        if (param->sched_priority < 0 ||
-           param->sched_priority > MAX_USER_RT_PRIO-1)
+           (p->mm &&  param->sched_priority > MAX_USER_RT_PRIO-1) ||
+           (!p->mm && param->sched_priority > MAX_RT_PRIO-1))
                return -EINVAL;
        if ((policy == SCHED_NORMAL) != (param->sched_priority == 0))
                return -EINVAL;