simple task_prio() fix

simple task_prio() fix

Post by Robert Lov » Sun, 09 Mar 2003 00:20:14



Linus, while we are on the subject of the scheduler...

Trivial fix for task_prio() in the case MAX_RT_PRIO != MAX_USER_RT_PRIO
where all priorities are skewed by (MAX_RT_PRIO - MAX_USER_RT_PRIO).
The fix 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.

Patch is against current BK - please, apply.

        Robert Love

 kernel/sched.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -urN linux-2.5.64-bk/kernel/sched.c linux/kernel/sched.c
--- linux-2.5.64-bk/kernel/sched.c      2003-03-07 17:01:34.727552472 -0500

  */
 int task_prio(task_t *p)
 {
-       return p->prio - MAX_USER_RT_PRIO;
+       return p->prio - MAX_RT_PRIO;
 }

 /**

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. task_prio() fix

Looks like task_prio() should do:

        int task_prio(task_t *p)
        {
                return p->prio - MAX_RT_PRIO;
        }

Instead of subtracting MAX_USER_RT_PRIO, since the maximum _user_ value
has nothing to do with the maximum that may be stored.  The effect is if
MAX_RT_PRIO != MAX_USER_RT_PRIO, then all priorities are skewed by
(MAX_RT_PRIO - MAX_USER_RT_PRIO).

Ingo, this looks trivial to me... but I swear it _used_ to work and this
function has always been like this.  Comments?

Patch is against 2.5.62.

        Robert Love

 kernel/sched.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -urN linux-2.5.62/kernel/sched.c linux/kernel/sched.c
--- linux-2.5.62/kernel/sched.c 2003-02-20 18:30:08.232619488 -0500

  */
 int task_prio(task_t *p)
 {
-       return p->prio - MAX_USER_RT_PRIO;
+       return p->prio - MAX_RT_PRIO;
 }

 /**

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. SCO ct like utility for Linux? (call terminal, call back)

3. trivial task_prio() fix

4. Need HELP in LILO SETUP.

5. PATCH: fix ALi 32bitisms, fix ALi FIFO, fix ALi IRQ crash

6. 40 GB IDE disk on 2.6

7. telnet hang - must be simple fix

8. Threads in the kernel space

9. Simple fix I hope..!

10. /vmunix disappeared; will a simple copy fix it?

11. This should be a simple fix....

12. Please help fix this simple printing problem (Mandrake 9.0)

13. 2.1.20 break st.o module (simple fix)...