[Devel] [PATCH RHEL7 COMMIT] fs/mm: writeback: fix div/0

Konstantin Khorenko khorenko at virtuozzo.com
Thu Apr 14 02:10:46 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.9
------>
commit 27f9ea1fd9ef90a68115fcc3eae26151ead2b0f0
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Thu Apr 14 13:10:46 2016 +0400

    fs/mm: writeback: fix div/0
    
    https://jira.sw.ru/browse/PSBM-46146
    
    Fixes: d179e86ac429 ("fs/mm: writeback: fix per bdi dirty background threshold calculation")
    Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 fs/fs-writeback.c   | 2 +-
 mm/page-writeback.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 55eca54..5c9a082 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -845,7 +845,7 @@ static bool over_bground_thresh(struct backing_dev_info *bdi)
 
 	bdi_thresh = bdi_dirty_limit(bdi, dirty_thresh);
 	bdi_bg_thresh = div_u64((u64)bdi_thresh * background_thresh,
-				dirty_thresh);
+				dirty_thresh + 1);
 
 	if (bdi_stat(bdi, BDI_RECLAIMABLE) > bdi_bg_thresh)
 		return true;
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 35e3ba8..9940d5f 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -791,7 +791,8 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi,
 		if (bdi_dirty >= bdi_thresh)
 			return 0;
 
-		bdi_bg_thresh = div_u64((u64)bdi_thresh * bg_thresh, thresh);
+		bdi_bg_thresh = div_u64((u64)bdi_thresh * bg_thresh,
+					thresh + 1);
 		bdi_setpoint = dirty_freerun_ceiling(bdi_thresh,
 						     bdi_bg_thresh);
 


More information about the Devel mailing list