]> Git Repo - linux.git/commit - mm/page-writeback.c
writeback: fix possible underflow in write bandwidth calculation
authorTejun Heo <[email protected]>
Mon, 23 Mar 2015 04:18:48 +0000 (00:18 -0400)
committerJens Axboe <[email protected]>
Mon, 23 Mar 2015 15:35:58 +0000 (09:35 -0600)
commitc72efb658f7c8b27ca3d0efb5cfd5ded9fcac89e
tree46fcb556af8f2c2e826be2df54ae52e1c51427e6
parente6e96d73a2aaaa54ed2c0f98693f4bf572712f1c
writeback: fix possible underflow in write bandwidth calculation

From 1ebf33901ecc75d9496862dceb1ef0377980587c Mon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Mon, 23 Mar 2015 00:08:19 -0400

2f800fbd777b ("writeback: fix dirtied pages accounting on redirty")
introduced account_page_redirty() which reverts stat updates for a
redirtied page, making BDI_DIRTIED no longer monotonically increasing.

bdi_update_write_bandwidth() uses the delta in BDI_DIRTIED as the
basis for bandwidth calculation.  While unlikely, since the above
patch, the newer value may be lower than the recorded past value and
underflow the bandwidth calculation leading to a wild result.

Fix it by subtracing min of the old and new values when calculating
delta.  AFAIK, there hasn't been any report of it happening but the
resulting erratic behavior would be non-critical and temporary, so
it's possible that the issue is happening without being reported.  The
risk of the fix is very low, so tagged for -stable.

Signed-off-by: Tejun Heo <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Wu Fengguang <[email protected]>
Cc: Greg Thelen <[email protected]>
Fixes: 2f800fbd777b ("writeback: fix dirtied pages accounting on redirty")
Cc: [email protected]
Signed-off-by: Jens Axboe <[email protected]>
mm/page-writeback.c
This page took 0.057257 seconds and 4 git commands to generate.