Re: [PATCH] MAX_USER_RT_PRIO and MAX_RT_PRIO are wrong!

Steven Rostedt
2005-06-07T17:31:59Z

On Tue, 2005-06-07 at 10:48 -0500, Dean Nelson wrote:
> You are correct xpc_activating() needs to be changed to use MAX_RT_PRIO.
> So please do add that change to your patch.

I haven't tested this patch, I just used the previous patch (which I did
test) and added your change.

-- Steve

--- linux-2.6.12-rc6/kernel/sched.c.orig 2005-06-07 13:22:33.000000000 -0400
+++ linux-2.6.12-rc6/kernel/sched.c 2005-06-07 13:22:37.000000000 -0400
@@ -3347,7 +3347,7 @@
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;
}
@@ -3379,7 +3379,8 @@
* 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;
--- linux-2.6.12-rc6/arch/ia64/sn/kernel/xpc_main.c.orig 2005-06-07 13:23:26.000000000 -0400
+++ linux-2.6.12-rc6/arch/ia64/sn/kernel/xpc_main.c 2005-06-07 13:23:43.000000000 -0400
@@ -420,7 +420,7 @@
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;