2.4-ac: separate max RT from max user RT
PATCH 1/1 2.4-ac: separate max RT from max user RT
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
kernel/sched.c +15 -11
@@ -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 ;
Quoted 1 line · Robert Love
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