History

[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.

Steven Rostedt committed 21 years ago

Commit d46523e1 parent 18586e72 files · +4 −3Browse files

Unified · Split

2 files
  1. arch/ia64/sn/kernel/xpc_main.c +1 −1
  2. kernel/sched.c +3 −2
arch/ia64/sn/kernel/xpc_main.c+1−1
@@ -420,7 +420,7 @@ xpc_activating(void *__partid) · 419 unmodified lines
420420 partid_t partid = (u64) __partid;
421421 struct xpc_partition *part = &xpc_partitions[partid];
422422 unsigned long irq_flags;
423− struct sched_param param = { sched_priority: MAX_USER_RT_PRIO - 1 };
423+ struct sched_param param = { sched_priority: MAX_RT_PRIO - 1 };
424424 int ret;
425425
426426
kernel/sched.c+3−2
@@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_struct *p, int policy, int prio) · 3485 unmodified lines
34863486 p->policy = policy;
34873487 p->rt_priority = prio;
34883488 if (policy != SCHED_NORMAL)
3489− p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority;
3489+ p->prio = MAX_RT_PRIO-1 - p->rt_priority;
34903490 else
34913491 p->prio = p->static_prio;
34923492 }
@@ -3518,7 +3518,8 @@ recheck: · 25 unmodified lines
35183518 * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0.
35193519 */
35203520 if (param->sched_priority < 0 ||
3521− param->sched_priority > MAX_USER_RT_PRIO-1)
3521+ (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) ||
3522+ (!p->mm && param->sched_priority > MAX_RT_PRIO-1))
35223523 return -EINVAL;
35233524 if ((policy == SCHED_NORMAL) != (param->sched_priority == 0))
35243525 return -EINVAL;