lkml.org 
[lkml]   [2002]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] 2.4-ac: separate max RT from max user RT
From
Date
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

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;
\
 
 \ /
  Last update: 2005-03-22 13:25    [W:0.058 / U:0.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site