* [PATCH] fix (again) MAX_USER_RT_PRIO and MAX_RT_PRIO (was: MAX_USER_RT_PRIO and MAX_RT_PRIO are wrong!)
@ 2005-07-25 20:28 Steven Rostedt
2005-07-25 20:40 ` Lee Revell
2005-07-26 15:08 ` Dean Nelson
0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2005-07-25 20:28 UTC (permalink / raw)
To: LKML; +Cc: Linus Torvalds, Andrew Morton, Ingo Molnar, Dean Nelson
Andrew,
As we discussed in OLS, 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. I've already submitted this patch and it made it to -mm, but
never made it to mainline, so you told me to send it again and here it
is.
Also, shouldn't these values (MAX_RT_PRIO, MAX_USER_RT_PRIO) be user
configurable via a config parameter? If so, I can send a separate patch
to do just that.
Ingo,
I've CC you just because you are the schedule maintainer. You already
accepted this patch into your RT tree.
Dean,
I've CC you since it also has the change to
linux-2.6.13-rc3/arch/ia64/sn/kernel/xpc_main.c in it. But I don't see
this in -mm. I don't have a ia64 so I can't test it. You tested this
for me before, so it should still work. This part should be at least
acknowledged by you.
-- Steve
PS. I'm currently running this patched kernel with MAX_RT_USER set to 95
and MAX_RT_PRIO set to 100 on an SMP machine.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
--- linux-2.6.13-rc3/kernel/sched.c.orig 2005-07-25 10:16:31.000000000 -0400
+++ linux-2.6.13-rc3/kernel/sched.c 2005-07-25 10:23:35.000000000 -0400
@@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_s
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;
--- linux-2.6.13-rc3/arch/ia64/sn/kernel/xpc_main.c.orig 2005-07-25 10:23:22.000000000 -0400
+++ linux-2.6.13-rc3/arch/ia64/sn/kernel/xpc_main.c 2005-07-25 10:23:35.000000000 -0400
@@ -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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix (again) MAX_USER_RT_PRIO and MAX_RT_PRIO (was: MAX_USER_RT_PRIO and MAX_RT_PRIO are wrong!)
2005-07-25 20:28 [PATCH] fix (again) MAX_USER_RT_PRIO and MAX_RT_PRIO (was: MAX_USER_RT_PRIO and MAX_RT_PRIO are wrong!) Steven Rostedt
@ 2005-07-25 20:40 ` Lee Revell
2005-07-26 15:08 ` Dean Nelson
1 sibling, 0 replies; 3+ messages in thread
From: Lee Revell @ 2005-07-25 20:40 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Linus Torvalds, Andrew Morton, Ingo Molnar, Dean Nelson
On Mon, 2005-07-25 at 16:28 -0400, Steven Rostedt wrote:
> Ingo,
>
> I've CC you just because you are the schedule maintainer. You already
> accepted this patch into your RT tree.
>
Please make sure to pick up this patch from Andreas Steinmetz too,
otherwise the rlimits are broken:
--- linux.orig/kernel/sched.c 2005-07-22 19:45:05.000000000 +0200
+++ linux/kernel/sched.c 2005-07-22 19:45:42.000000000 +0200
@@ -3528,7 +3528,8 @@
*/
if (!capable(CAP_SYS_NICE)) {
/* can't change policy */
- if (policy != p->policy)
+ if (policy != p->policy &&
+ !p->signal->rlim[RLIMIT_RTPRIO].rlim_cur)
return -EPERM;
/* can't increase priority */
if (policy != SCHED_NORMAL &&
Lee
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix (again) MAX_USER_RT_PRIO and MAX_RT_PRIO (was: MAX_USER_RT_PRIO and MAX_RT_PRIO are wrong!)
2005-07-25 20:28 [PATCH] fix (again) MAX_USER_RT_PRIO and MAX_RT_PRIO (was: MAX_USER_RT_PRIO and MAX_RT_PRIO are wrong!) Steven Rostedt
2005-07-25 20:40 ` Lee Revell
@ 2005-07-26 15:08 ` Dean Nelson
1 sibling, 0 replies; 3+ messages in thread
From: Dean Nelson @ 2005-07-26 15:08 UTC (permalink / raw)
To: Steven Rostedt; +Cc: torvalds, akpm, mingo, dcn, linux-kernel
Steve, your change to XPC looks good. Thanks, Dean
Signed-off-by: Dean Nelson <dcn@sgi.com>
On Mon, Jul 25, 2005 at 04:28:39PM -0400, Steven Rostedt wrote:
> Dean,
>
> I've CC you since it also has the change to
> linux-2.6.13-rc3/arch/ia64/sn/kernel/xpc_main.c in it. But I don't see
> this in -mm. I don't have a ia64 so I can't test it. You tested this
> for me before, so it should still work. This part should be at least
> acknowledged by you.
>
> -- Steve
>
> PS. I'm currently running this patched kernel with MAX_RT_USER set to 95
> and MAX_RT_PRIO set to 100 on an SMP machine.
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
>
> --- linux-2.6.13-rc3/kernel/sched.c.orig 2005-07-25 10:16:31.000000000 -0400
> +++ linux-2.6.13-rc3/kernel/sched.c 2005-07-25 10:23:35.000000000 -0400
> @@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_s
> 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;
> --- linux-2.6.13-rc3/arch/ia64/sn/kernel/xpc_main.c.orig 2005-07-25 10:23:22.000000000 -0400
> +++ linux-2.6.13-rc3/arch/ia64/sn/kernel/xpc_main.c 2005-07-25 10:23:35.000000000 -0400
> @@ -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;
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-07-26 15:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-25 20:28 [PATCH] fix (again) MAX_USER_RT_PRIO and MAX_RT_PRIO (was: MAX_USER_RT_PRIO and MAX_RT_PRIO are wrong!) Steven Rostedt
2005-07-25 20:40 ` Lee Revell
2005-07-26 15:08 ` Dean Nelson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox