Commit d46523ea authored by Steven Rostedt's avatar Steven Rostedt Committed by Linus Torvalds

[PATCH] fix MAX_USER_RT_PRIO and MAX_RT_PRIO

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: default avatarSteven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarDean Nelson <dcn@sgi.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 18586e72
...@@ -420,7 +420,7 @@ xpc_activating(void *__partid) ...@@ -420,7 +420,7 @@ xpc_activating(void *__partid)
partid_t partid = (u64) __partid; partid_t partid = (u64) __partid;
struct xpc_partition *part = &xpc_partitions[partid]; struct xpc_partition *part = &xpc_partitions[partid];
unsigned long irq_flags; 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; int ret;
......
...@@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_struct *p, int policy, int prio) ...@@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_struct *p, int policy, int prio)
p->policy = policy; p->policy = policy;
p->rt_priority = prio; p->rt_priority = prio;
if (policy != SCHED_NORMAL) if (policy != SCHED_NORMAL)
p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority; p->prio = MAX_RT_PRIO-1 - p->rt_priority;
else else
p->prio = p->static_prio; p->prio = p->static_prio;
} }
...@@ -3518,7 +3518,8 @@ int sched_setscheduler(struct task_struct *p, int policy, struct sched_param *pa ...@@ -3518,7 +3518,8 @@ int sched_setscheduler(struct task_struct *p, int policy, struct sched_param *pa
* 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0. * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0.
*/ */
if (param->sched_priority < 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; return -EINVAL;
if ((policy == SCHED_NORMAL) != (param->sched_priority == 0)) if ((policy == SCHED_NORMAL) != (param->sched_priority == 0))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment