• Rick Lindsley's avatar
    [PATCH] scheduler statistics · 7394ebbd
    Rick Lindsley authored
    It adds lots of CPU scheduler stats in /proc/pid/stat.  They are described in
    the new Documentation//sched-stats.txt
    
    We were carrying this patch offline for some time, but as there's still
    considerable ongoing work in this area, and as the new stats are a
    configuration option, I think it's best that this capability be in the base
    kernel.
    
    Nick removed a fair amount of statistics that he wasn't using.  The full patch
    gathers more information.  In particular, his patch doesn't include the code
    to measure the latency between the time a process is made runnable and the
    time it hits a processor which will be key to measuring interactivity changes.
    
    He passed his changes back to me and I got finished merging his changes with
    the current statistics patches just before OLS.  I believe this is largely a
    superset of the patch you grabbed and should port relatively easily too.
    
    Versions also exist for
    
        2.6.8-rc2
        2.6.8-rc2-mm1
        2.6.8-rc2-mm2
    
    at
        http://eaglet.rain.com/rick/linux/schedstat/patches/
    
    and within 24 hours at
    
        http://oss.software.ibm.com/linux/patches/?patch_id=730&show=all
    
    The version below is for 2.6.8-rc2-mm2 without the staircase code and has
    been compiled cleanly but not yet run.
    
    From: Ingo Molnar <mingo@elte.hu>
    
    this code needs a couple of cleanups before it can go into mainline:
    
    fs/proc/array.c, fs/proc/base.c, fs/proc/proc_misc.c:
    
     - moved the new /proc/<PID>/stat fields to /proc/<PID>/schedstat,
       because the new fields break older procps. It's cleaner this way
       anyway. This moving of fields necessiated a bump to version 10.
    
    Documentation/sched-stats.txt:
    
     - updated sched-stats.txt for version 10
    
     - wake_up_forked_thread() => wake_up_new_task()
    
     - updated the per-process field description
    
    Kconfig:
    
     - removed the default y and made the option dependent on DEBUG_KERNEL. 
       This is really for scheduler analysis, normal users dont need the 
       overhead.
    
    include/linux/sched.h:
    
     - moved the definitions into kernel/sched.c - this fixes UP compilation
       and is cleaner.
    
     - also moved the sched-domain definitions to sched.c - now that the 
       sched-domains internals are not exposed to architectures this is
       doable. It's also necessary due to the previous change.
    
    kernel/fork.c:
    
     - moved the ->sched_info init to sched_fork() where it belongs.
    
    kernel/sched.c:
    
     - wake_up_forked_thread() -> wake_up_new_task(), wuft_cnt -> wunt_cnt,
       wuft_moved -> wunt_moved.
    
     - wunt_cnt and wunt_moved were defined by never updated - added the 
       missing code to wake_up_new_task().
    
     - whitespace/style police
    
     - removed whitespace changes done to code not related to schedstats -
       i'll send a separate patch for these (and more).
    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>
    7394ebbd
base.c 42.5 KB