Insight into Load, Runnable, and Utilization Averages in Linux Scheduler Code

iso m isomorphik.ibm at gmail.com
Fri Dec 15 16:36:31 EST 2023


Hello there,

Below snippet is taken from file: include/linux/sched.h

>/*
> * The load/runnable/util_avg accumulates an infinite geometric series
> * (see __update_load_avg_cfs_rq() in kernel/sched/pelt.c).
> *
> * [load_avg definition]
> *
> *   load_avg = runnable% * scale_load_down(load)
> *
> * [runnable_avg definition]
> *
> *   runnable_avg = runnable% * SCHED_CAPACITY_SCALE
> *
> * [util_avg definition]
> *
> *   util_avg = running% * SCHED_CAPACITY_SCALE
> *
> * where runnable% is the time ratio that a sched_entity is runnable and
> * running% the time ratio that a sched_entity is running.
what's the denominator that's being considered here? Is it a period? or time
between two scheduler ticks?
> *
> * For cfs_rq, they are the aggregated values of all runnable and blocked
> * sched_entities.
> *
> * The load/runnable/util_avg doesn't directly factor frequency scaling and CPU
> * capacity scaling. The scaling is done through the rq_clock_pelt that is used
> * for computing those signals (see update_rq_clock_pelt())
> *
> * N.B., the above ratios (runnable% and running%) themselves are in the
> * range of [0, 1]. To do fixed point arithmetics, we therefore scale them
> * to as large a range as necessary. This is for example reflected by
> * util_avg's SCHED_CAPACITY_SCALE.

Thanks
Vishal



More information about the Kernelnewbies mailing list