]> git.karo-electronics.de Git - karo-tx-linux.git/commit
writeback: dirty ratelimit - think time compensation
authorWu Fengguang <fengguang.wu@intel.com>
Sun, 12 Jun 2011 01:25:42 +0000 (19:25 -0600)
committerWu Fengguang <fengguang.wu@intel.com>
Mon, 5 Dec 2011 06:06:29 +0000 (14:06 +0800)
commit78be8c0ebf7e21d72dff7e896deba4880b50a61a
treef3b5ea2904e8aa147351abda5db9b8b199ee58c9
parent22b9c4ecbac8e66f3ac7a5b7220c29fe3d1b5223
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: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
include/linux/sched.h
include/trace/events/writeback.h
kernel/fork.c
mm/page-writeback.c