diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2011-06-11 21:25:42 -0400 |
---|---|---|
committer | Wu Fengguang <fengguang.wu@intel.com> | 2011-12-18 01:20:27 -0500 |
commit | 83712358ba0a1497ce59a4f84ce4dd0f803fe6fc (patch) | |
tree | d17ab27a7bff50616e3b63ad137c004d9ccfbcb0 /include/linux/sched.h | |
parent | 32c7f202a4801252a0f3578807b75a961f792870 (diff) |
writeback: dirty ratelimit - think time compensation
Compensate the task's think time when computing the final pause time,
so that ->dirty_ratelimit can be executed accurately.
think time := time spend outside of balance_dirty_pages()
In the rare case that the task slept longer than the 200ms period time
(result in negative pause time), the sleep time will be compensated in
the following periods, too, if it's less than 1 second.
Accumulated errors are carefully avoided as long as the max pause area
is not hitted.
Pseudo code:
period = pages_dirtied / task_ratelimit;
think = jiffies - dirty_paused_when;
pause = period - think;
1) normal case: period > think
pause = period - think
dirty_paused_when = jiffies + pause
nr_dirtied = 0
period time
|===============================>|
think time pause time
|===============>|==============>|
------|----------------|---------------|------------------------
dirty_paused_when jiffies
2) no pause case: period <= think
don't pause; reduce future pause time by:
dirty_paused_when += period
nr_dirtied = 0
period time
|===============================>|
think time
|===================================================>|
------|--------------------------------+-------------------|----
dirty_paused_when jiffies
Acked-by: Jan Kara <jack@suse.cz>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 1c4f3e9b9bc5..984c3b295978 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1527,6 +1527,7 @@ struct task_struct { | |||
1527 | */ | 1527 | */ |
1528 | int nr_dirtied; | 1528 | int nr_dirtied; |
1529 | int nr_dirtied_pause; | 1529 | int nr_dirtied_pause; |
1530 | unsigned long dirty_paused_when; /* start of a write-and-pause period */ | ||
1530 | 1531 | ||
1531 | #ifdef CONFIG_LATENCYTOP | 1532 | #ifdef CONFIG_LATENCYTOP |
1532 | int latency_record_count; | 1533 | int latency_record_count; |