• Y
    alinux: sched: Introduce per-cgroup idle accounting · 61e58859
    Yihao Wu 提交于
    to #26424323
    
    Since we concern idle, let's take idle as the center state. And omit
    transition between other stats. Below is the state transition graph:
    
                                    sleep->deque
    +-----------+ cpumask +-------+ exit->deque +-------+
    |ineffective|-------- | idle  | <-----------|running|
    +-----------+         +-------+             +-------+
                            ^ |
     unthrtl child -> deque | |
              wake -> deque | |thrtl chlid -> enque
           migrate -> deque | |migrate -> enque
                            | v
                          +-------+
                          | steal |
                          +-------+
    
    We conclude idle state condition as:
    
    !se->on_rq && !my_q->throttled && cpu allowed.
    
    From this graph and condition, we can hook (de|en)queue_task_fair
    update_cpumasks_hier, (un|)throttle_cfs_rq to account idle state.
    
    In the hooked functions, we also check the conditions, to avoid
    accounting unwanted cpu clocks.
    Signed-off-by: NYihao Wu <wuyihao@linux.alibaba.com>
    Signed-off-by: NShanpei Chen <shanpeic@linux.alibaba.com>
    Acked-by: NMichael Wang <yun.wang@linux.alibaba.com>
    61e58859
fair.c 272.1 KB