• Y
    sched/fair: Initiate a new task's util avg to a bounded value · 2b8c41da
    Yuyang Du 提交于
    A new task's util_avg is set to full utilization of a CPU (100% time
    running). This accelerates a new task's utilization ramp-up, useful to
    boost its execution in early time. However, it may result in
    (insanely) high utilization for a transient time period when a flood
    of tasks are spawned. Importantly, it violates the "fundamentally
    bounded" CPU utilization, and its side effect is negative if we don't
    take any measure to bound it.
    
    This patch proposes an algorithm to address this issue. It has
    two methods to approach a sensible initial util_avg:
    
    (1) An expected (or average) util_avg based on its cfs_rq's util_avg:
    
      util_avg = cfs_rq->util_avg / (cfs_rq->load_avg + 1) * se.load.weight
    
    (2) A trajectory of how successive new tasks' util develops, which
    gives 1/2 of the left utilization budget to a new task such that
    the additional util is noticeably large (when overall util is low) or
    unnoticeably small (when overall util is high enough). In the meantime,
    the aggregate utilization is well bounded:
    
      util_avg_cap = (1024 - cfs_rq->avg.util_avg) / 2^n
    
    where n denotes the nth task.
    
    If util_avg is larger than util_avg_cap, then the effective util is
    clamped to the util_avg_cap.
    Reported-by: NAndrey Ryabinin <aryabinin@virtuozzo.com>
    Signed-off-by: NYuyang Du <yuyang.du@intel.com>
    Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: bsegall@google.com
    Cc: morten.rasmussen@arm.com
    Cc: pjt@google.com
    Cc: steve.muckle@linaro.org
    Link: http://lkml.kernel.org/r/1459283456-21682-1-git-send-email-yuyang.du@intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
    2b8c41da
sched.h 47.0 KB