Skip to content

Commit

Permalink
mm: fix arithmetic for max_prop_frac when setting max_ratio
Browse files Browse the repository at this point in the history
Since now bdi->max_ratio is part per million, fix the wrong arithmetic for
max_prop_frac when setting max_ratio.  Otherwise the miscalculated
max_prop_frac will affect the incrementing of writeout completion count
when max_ratio is not 100%.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: efc3e6a ("mm: split off __bdi_set_max_ratio() function")
Signed-off-by: Jingbo Xu <[email protected]>
Cc: Joseph Qi <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Stefan Roesch <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
lostjeffle authored and akpm00 committed Dec 29, 2023
1 parent e0646b7 commit fa151a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ static int __bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ra
ret = -EINVAL;
} else {
bdi->max_ratio = max_ratio;
bdi->max_prop_frac = (FPROP_FRAC_BASE * max_ratio) / 100;
bdi->max_prop_frac = (FPROP_FRAC_BASE * max_ratio) /
(100 * BDI_RATIO_SCALE);
}
spin_unlock_bh(&bdi_lock);

Expand Down

0 comments on commit fa151a3

Please sign in to comment.