• Ingo Molnar's avatar
    [PATCH] sched: fix timeslice calculations for HZ=1000. · b2a0e913
    Ingo Molnar authored
    The main benefit is that with the default HZ=1000 nice +19 tasks now get 5
    msecs of timeslices, so the ratio of CPU use is linear.  (nice 0 task gets
    20 times more CPU time than a nice 19 task.  Prior this change the ratio
    was 1:10)
    
    another effect is that nice 0 tasks now get a round 100 msecs of timeslices
    (as intended), instead of 102 msecs.
    
    here's a table of old/new timeslice values, for HZ=1000 and 100:
    
                          HZ=1000         (   HZ=100   )
                        old    new        ( old    new )
    
            nice -20:   200    200        ( 200    200 )
            nice -19:   195    195        ( 190    190 )
            ...
            nice 0:     102    100        ( 100    100 )
            nice 1:      97     95        (  90     90 )
            nice 2:      92     90        (  90     90 )
            ...
            nice 17:     19     15        (  10     10 )
            nice 18:     14     10        (  10     10 )
            nice 19:     10      5        (  10     10 )
    
    i've tested the patch on x86.
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    b2a0e913
sched.c 98.4 KB