Skip to contentSkip to conversation

trivial task_prio() fix

PATCH In review Robert Love 2 participants 2 messages Mar 25, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trivial task_prio() fix

Trivial fix for task_prio() in the case MAX_RT_PRIO != MAX_USER_RT_PRIO. In this case, all priorities are skewed by (MAX_RT_PRIO - MAX_USER_RT_PRIO).

The fix is to subtract the full MAX_RT_PRIO from p->prio, not just MAX_USER_RT_PRIO. This makes sense, as the full priority range is unrelated to the maximum user value. Only the real maximum RT value matters.

The object code is the same for the 99% of the people who do not touch the real-time priority defines.

This has been in Andrew's tree for awhile, with no issue. I have also posted here to no complaint. Patch is against 2.5.66, please apply.

Robert Love

 kernel/sched.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
kernel/sched.c +1 -1
diff -urN linux-2.5.66/kernel/sched.c linux/kernel/sched.c
@@ -1680,7 +1680,7 @@
  */
 int task_prio(task_t *p)
 {
-	return p->prio - MAX_USER_RT_PRIO;
+	return p->prio - MAX_RT_PRIO;
 }
 
 /**
#1 lore raw

kernel/sched.c line 1684

Quoted 5 lines · Robert Love

int task_prio(task_t *p)
{

kernel/sched.c +1 -1
-	return p->prio - MAX_USER_RT_PRIO;
+	return p->prio - MAX_RT_PRIO;
 }

looks good to me.

Ingo