* [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob
@ 2025-12-11 2:35 Jingbo Xu
2025-12-11 2:35 ` [PATCH 1/2] mm: fix arithmetic for bdi min_ratio Jingbo Xu
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jingbo Xu @ 2025-12-11 2:35 UTC (permalink / raw)
To: gregkh, sashal, stable; +Cc: jefflexu
Have no idea why stable branch missed the "fix" tag.
Jingbo Xu (2):
mm: fix arithmetic for bdi min_ratio
mm: fix arithmetic for max_prop_frac when setting max_ratio
mm/page-writeback.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.19.1.6.gb485710b
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] mm: fix arithmetic for bdi min_ratio
2025-12-11 2:35 [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob Jingbo Xu
@ 2025-12-11 2:35 ` Jingbo Xu
2025-12-11 2:35 ` [PATCH 2/2] mm: fix arithmetic for max_prop_frac when setting max_ratio Jingbo Xu
2026-01-08 11:07 ` [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob Greg KH
2 siblings, 0 replies; 5+ messages in thread
From: Jingbo Xu @ 2025-12-11 2:35 UTC (permalink / raw)
To: gregkh, sashal, stable; +Cc: jefflexu
commit e0646b7590084a5bf3b056d3ad871d9379d2c25a upstream.
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/20231219142508.86265-2-jefflexu@linux.alibaba.com
Fixes: 8021fb3232f2 ("mm: split off __bdi_set_min_ratio() function")
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reported-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Stefan Roesch <shr@devkernel.io>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/page-writeback.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 9ceb841af819..3929bb0a7501 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -714,7 +714,6 @@ static int __bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ra
if (min_ratio > 100 * BDI_RATIO_SCALE)
return -EINVAL;
- min_ratio *= BDI_RATIO_SCALE;
spin_lock_bh(&bdi_lock);
if (min_ratio > bdi->max_ratio) {
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] mm: fix arithmetic for max_prop_frac when setting max_ratio
2025-12-11 2:35 [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob Jingbo Xu
2025-12-11 2:35 ` [PATCH 1/2] mm: fix arithmetic for bdi min_ratio Jingbo Xu
@ 2025-12-11 2:35 ` Jingbo Xu
2026-01-08 11:07 ` [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob Greg KH
2 siblings, 0 replies; 5+ messages in thread
From: Jingbo Xu @ 2025-12-11 2:35 UTC (permalink / raw)
To: gregkh, sashal, stable; +Cc: jefflexu
commit fa151a39a6879144b587f35c0dfcc15e1be9450f upstream.
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/20231219142508.86265-3-jefflexu@linux.alibaba.com
Fixes: efc3e6ad53ea ("mm: split off __bdi_set_max_ratio() function")
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Stefan Roesch <shr@devkernel.io>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/page-writeback.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 3929bb0a7501..e7a7233f6d5d 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -750,7 +750,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);
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob
2025-12-11 2:35 [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob Jingbo Xu
2025-12-11 2:35 ` [PATCH 1/2] mm: fix arithmetic for bdi min_ratio Jingbo Xu
2025-12-11 2:35 ` [PATCH 2/2] mm: fix arithmetic for max_prop_frac when setting max_ratio Jingbo Xu
@ 2026-01-08 11:07 ` Greg KH
2026-01-09 1:38 ` Jingbo Xu
2 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2026-01-08 11:07 UTC (permalink / raw)
To: Jingbo Xu; +Cc: sashal, stable
On Thu, Dec 11, 2025 at 10:35:05AM +0800, Jingbo Xu wrote:
> Have no idea why stable branch missed the "fix" tag.
Because that does not guarantee a patch will ever be backported. See:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly in the future.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob
2026-01-08 11:07 ` [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob Greg KH
@ 2026-01-09 1:38 ` Jingbo Xu
0 siblings, 0 replies; 5+ messages in thread
From: Jingbo Xu @ 2026-01-09 1:38 UTC (permalink / raw)
To: Greg KH; +Cc: sashal, stable
On 1/8/26 7:07 PM, Greg KH wrote:
> On Thu, Dec 11, 2025 at 10:35:05AM +0800, Jingbo Xu wrote:
>> Have no idea why stable branch missed the "fix" tag.
>
> Because that does not guarantee a patch will ever be backported. See:
> https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> for how to do this properly in the future.
>
Sorry I though that a 'fix' tag suffices for stable tree. Thanks for
the pointer.
--
Thanks,
Jingbo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-09 1:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-11 2:35 [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob Jingbo Xu
2025-12-11 2:35 ` [PATCH 1/2] mm: fix arithmetic for bdi min_ratio Jingbo Xu
2025-12-11 2:35 ` [PATCH 2/2] mm: fix arithmetic for max_prop_frac when setting max_ratio Jingbo Xu
2026-01-08 11:07 ` [6.6-stable 0/2] mm: two fixes for bdi min_ratio and max_ratio knob Greg KH
2026-01-09 1:38 ` Jingbo Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox