2017-06-15 14:26:11

by cee1

[permalink] [raw]
Subject: What is the math behind sched_avg_update()?

Hi all,

In update_cpu_capacity(), it will calculate CPU's capacity with RT
utilization in mind. Which is introduced in commit
e9e9250bc78e7f6342517214c0178a529807964b
(https://lkml.org/lkml/2009/8/27/209).

rq->rt_avg and rq->age_stamp are introduced for tracing RT utilization in

a) update_curr_rt
sched_rt_avg_update
sched_avg_update

b) scheduler_tick
cpu_load_update_active
cpu_load_update_periodic (or cpu_load_update_nohz)
cpu_load_update
sched_avg_update


Curious about sched_avg_update(), why "rt->avg / 2^n" (where n denotes
periods passed since rq->age_stamp)?
- It will be a big summed value if next will meet the end of current
period, assuming several RT tasks are running
- But it will suddenly reduce to 1/2^n if just passed several periods

So, what is the math behind sched_avg_update()?



--
Regards,

- cee1