Skip to content

Commit e0646b7

Browse files
lostjeffleakpm00
authored andcommitted
mm: fix arithmetic for bdi min_ratio
Since now bdi->min_ratio is part per million, fix the wrong arithmetic. Otherwise it will fail with -EINVAL when setting a reasonable min_ratio, as it tries to set min_ratio to (min_ratio * BDI_RATIO_SCALE) in percentage unit, which exceeds 100% anyway. # cat /sys/class/bdi/253\:0/min_ratio 0 # cat /sys/class/bdi/253\:0/max_ratio 100 # echo 1 > /sys/class/bdi/253\:0/min_ratio -bash: echo: write error: Invalid argument Link: https://lkml.kernel.org/r/[email protected] Fixes: 8021fb3 ("mm: split off __bdi_set_min_ratio() function") Signed-off-by: Jingbo Xu <[email protected]> Reported-by: Joseph Qi <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Stefan Roesch <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent efa7df3 commit e0646b7

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

mm/page-writeback.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,6 @@ static int __bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ra
692692

693693
if (min_ratio > 100 * BDI_RATIO_SCALE)
694694
return -EINVAL;
695-
min_ratio *= BDI_RATIO_SCALE;
696695

697696
spin_lock_bh(&bdi_lock);
698697
if (min_ratio > bdi->max_ratio) {

0 commit comments

Comments
 (0)