• Josh Don's avatar
    sched/core: Forced idle accounting · 4feee7d1
    Josh Don authored
    Adds accounting for "forced idle" time, which is time where a cookie'd
    task forces its SMT sibling to idle, despite the presence of runnable
    tasks.
    
    Forced idle time is one means to measure the cost of enabling core
    scheduling (ie. the capacity lost due to the need to force idle).
    
    Forced idle time is attributed to the thread responsible for causing
    the forced idle.
    
    A few details:
     - Forced idle time is displayed via /proc/PID/sched. It also requires
       that schedstats is enabled.
     - Forced idle is only accounted when a sibling hyperthread is held
       idle despite the presence of runnable tasks. No time is charged if
       a sibling is idle but has no runnable tasks.
     - Tasks with 0 cookie are never charged forced idle.
     - For SMT > 2, we scale the amount of forced idle charged based on the
       number of forced idle siblings. Additionally, we split the time up and
       evenly charge it to all running tasks, as each is equally responsible
       for the forced idle.
    Signed-off-by: default avatarJosh Don <joshdon@google.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lkml.kernel.org/r/20211018203428.2025792-1-joshdon@google.com
    4feee7d1
fair.c 311 KB