diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2011-11-07 19:19:28 +0800 |
---|---|---|
committer | Wu Fengguang <fengguang.wu@intel.com> | 2011-11-07 19:19:28 +0800 |
commit | 3a73dbbc9bb3fc8594cd67af4db6c563175dfddb (patch) | |
tree | e5120c19fd8e83a38d5c0852336a92c5b7862c6a /mm/page-writeback.c | |
parent | 31555213f03bca37d2c02e10946296052f4ecfcd (diff) | |
download | linux-stable-3a73dbbc9bb3fc8594cd67af4db6c563175dfddb.tar.gz linux-stable-3a73dbbc9bb3fc8594cd67af4db6c563175dfddb.tar.bz2 linux-stable-3a73dbbc9bb3fc8594cd67af4db6c563175dfddb.zip |
writeback: fix uninitialized task_ratelimit
In balance_dirty_pages() task_ratelimit may be not initialized
(initialization skiped by goto pause), and then used when calling
tracing hook.
Fix it by moving the task_ratelimit assignment before goto pause.
Reported-by: Witold Baryluk <baryluk@smp.if.uj.edu.pl>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r-- | mm/page-writeback.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 0360d1b5a1dd..a3278f005230 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -1097,13 +1097,13 @@ static void balance_dirty_pages(struct address_space *mapping, pos_ratio = bdi_position_ratio(bdi, dirty_thresh, background_thresh, nr_dirty, bdi_thresh, bdi_dirty); - if (unlikely(pos_ratio == 0)) { + task_ratelimit = ((u64)dirty_ratelimit * pos_ratio) >> + RATELIMIT_CALC_SHIFT; + if (unlikely(task_ratelimit == 0)) { pause = max_pause; goto pause; } - task_ratelimit = (u64)dirty_ratelimit * - pos_ratio >> RATELIMIT_CALC_SHIFT; - pause = (HZ * pages_dirtied) / (task_ratelimit | 1); + pause = HZ * pages_dirtied / task_ratelimit; if (unlikely(pause <= 0)) { trace_balance_dirty_pages(bdi, dirty_thresh, |