public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.4-ac: separate max RT from max user RT
@ 2002-05-07 17:54 Robert Love
  2002-05-07 18:37 ` Robert Love
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Love @ 2002-05-07 17:54 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

Alan,

The attached patch separates the notion of "maximum real-time priority"
from what we actually export to user-space.  This will also us, in the
future, to have kernel threads with a greater RT priority than any user
task.

Right now the two values are set equal and thus the patch has no object
code changes.  It does provide a bit of a cleanup, however.

Patch is against 2.4.19-pre7-ac4, please apply.

	Robert Love


[-- Attachment #2: sched-misc-rml-2.4.19-pre7-ac4-1.patch --]
[-- Type: text/x-patch, Size: 2216 bytes --]

diff -urN linux-2.4.19-pre7-ac4/kernel/sched.c linux/kernel/sched.c
--- linux-2.4.19-pre7-ac4/kernel/sched.c	Mon Apr 29 12:33:23 2002
+++ linux/kernel/sched.c	Mon Apr 29 13:08:11 2002
@@ -22,13 +22,17 @@
 #include <linux/kernel_stat.h>
 
 /*
- * Priority of a process goes from 0 to MAX_PRIO-1.  The
- * 0 to MAX_RT_PRIO-1 priority range is allocated to RT tasks,
- * the MAX_RT_PRIO to MAX_PRIO range is for SCHED_OTHER tasks.
- * Priority values are inverted: lower p->prio value means higher
- * priority.
+ * Priority of a process goes from 0 to 139. The 0-99
+ * priority range is allocated to RT tasks, the 100-139
+ * range is for SCHED_OTHER tasks. Priority values are
+ * inverted: lower p->prio value means higher priority.
+ * 
+ * MAX_USER_RT_PRIO allows the actual maximum RT priority
+ * to be separate from the value exported to user-space.
+ * NOTE: MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
  */
 #define MAX_RT_PRIO		100
+#define MAX_USER_RT_PRIO	100
 #define MAX_PRIO		(MAX_RT_PRIO + 40)
 
 /*
@@ -1025,7 +1029,7 @@
  */
 int task_prio(task_t *p)
 {
-	return p->prio - MAX_RT_PRIO;
+	return p->prio - MAX_USER_RT_PRIO;
 }
 
 int task_nice(task_t *p)
@@ -1082,11 +1086,11 @@
 	}
 
 	/*
-	 * Valid priorities for SCHED_FIFO and SCHED_RR are 1..MAX_RT_PRIO-1,
-	 * valid priority for SCHED_OTHER is 0.
+	 * Valid priorities for SCHED_FIFO and SCHED_RR are
+	 * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_OTHER is 0.
 	 */
 	retval = -EINVAL;
-	if (lp.sched_priority < 0 || lp.sched_priority > MAX_RT_PRIO - 1)
+	if (lp.sched_priority < 0 || lp.sched_priority > MAX_USER_RT_PRIO-1)
 		goto out_unlock;
 	if ((policy == SCHED_OTHER) != (lp.sched_priority == 0))
 		goto out_unlock;
@@ -1106,7 +1110,7 @@
 	p->policy = policy;
 	p->rt_priority = lp.sched_priority;
 	if (policy != SCHED_OTHER)
-		p->prio = (MAX_RT_PRIO - 1) - p->rt_priority;
+		p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority;
 	else
 		p->prio = p->static_prio;
 	if (array)
@@ -1229,7 +1233,7 @@
 	switch (policy) {
 	case SCHED_FIFO:
 	case SCHED_RR:
-		ret = MAX_RT_PRIO - 1;
+		ret = MAX_USER_RT_PRIO-1;
 		break;
 	case SCHED_OTHER:
 		ret = 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] 2.4-ac: separate max RT from max user RT
  2002-05-07 17:54 [PATCH] 2.4-ac: separate max RT from max user RT Robert Love
@ 2002-05-07 18:37 ` Robert Love
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Love @ 2002-05-07 18:37 UTC (permalink / raw)
  To: Robert Love; +Cc: alan, linux-kernel

On Tue, 2002-05-07 at 10:54, Robert Love wrote:
> Patch is against 2.4.19-pre7-ac4, please apply.

Alan et al,

I should also mention the patches are available from

	http://www.kernel.org/pub/linux/kernel/people/rml/sched/for_alan/

as 145, 165, and 175.  The README explains the chunks.

	Robert Love



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-07 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-07 17:54 [PATCH] 2.4-ac: separate max RT from max user RT Robert Love
2002-05-07 18:37 ` Robert Love

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox