- 论坛徽章:
- 0
|
As mentioned above
delta_time = now - prev_stored_now
se.wait_runtime = delta_time - delta_exec_time
According to these definitions, CFS scheduler can work smoothly. But there are some other factors to affect the fairness. We should take these factors into account. Then CFS scheduler
1. tunes se.fair_key:
se.fair_key = cfs_rq.fair_clock - se.wait_runtime, if se.load_weight == NICE_0_LOAD;
se.fair_key = cfs_rq.fair_clock - se.wait_runtime * NICE_0_LOAD / se.load_weight,
if se.load_weight != NICE_0_LOAD && se.wait_runtime = 0
2. tunes se.wait_runtime
a. a task is in run queue, but not run on the cpu
se.wait_runtime += (now - prev_stored_now) * se.load_weight / NICE_0_LOAD
b. a task gets added back to the runnable tasks and gets a small credit for the cpu time it missed out on.
se.wait_runtime += delta * cfs_rq.nr_running
c. a task wakes-up from sleeping or blockint state
se.wait_runtime += delta_sleep_fair * se.load_weight / NICE_0_LOAD
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/103132/showart_2040027.html |
|