• Dmitry Adamushko's avatar
    sched: tidy up SCHED_RR · a4ec24b4
    Dmitry Adamushko authored
    - make timeslices of SCHED_RR tasks constant and not
    dependent on task's static_prio [1] ;
    - remove obsolete code (timeslice related bits);
    - make sched_rr_get_interval() return something more
    meaningful [2] for SCHED_OTHER tasks.
    
    [1] according to the following link, it's not compliant with SUSv3
    (not sure though, what is the reference for us :-)
    http://lkml.org/lkml/2007/3/7/656
    
    [2] the interval is dynamic and can be depicted as follows "should a
    task be one of the runnable tasks at this particular moment, it would
    expect to run for this interval of time before being re-scheduled by the
    scheduler tick".
    (i.e. it's more precise if a task is runnable at the moment)
    
    yeah, this seems to require task_rq_lock/unlock() but this is not a hot
    path.
    
    results:
    
    (SCHED_FIFO)
    
    dimm@earth:~/storage/prog$ sudo chrt -f 10 ./rr_interval 
    time_slice: 0 : 0
    
    (SCHED_RR)
    
    dimm@earth:~/storage/prog$ sudo chrt 10 ./rr_interval 
    time_slice: 0 : 99984800
    
    (SCHED_NORMAL)
    
    dimm@earth:~/storage/prog$ ./rr_interval 
    time_slice: 0 : 19996960
    
    (SCHED_NORMAL + a cpu_hog of similar 'weight' on the same CPU --- so should be a half of the previous result)
    
    dimm@earth:~/storage/prog$ taskset 1 ./rr_interval 
    time_slice: 0 : 9998480
    Signed-off-by: default avatarDmitry Adamushko <dmitry.adamushko@gmail.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    a4ec24b4
sched.c 169 KB