2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/mm/damon
Quanmin Yan 9f68eabab9 mm/damon/core: prevent unnecessary overflow in damos_set_effective_quota()
On 32-bit systems, the throughput calculation in
damos_set_effective_quota() is prone to unnecessary multiplication
overflow.  Using mult_frac() to fix it.

Andrew Paniakin also recently found and privately reported this issue, on
64 bit systems.  This can also happen on 64-bit systems, once the charged
size exceeds ~17 TiB.  On systems running for long time in production,
this issue can actually happen.

More specifically, when a DAMOS scheme having the time quota run for
longtime, throughput calculation can overflow and set esz too small.  As a
result, speed of the scheme get unexpectedly slow.

Link: https://lkml.kernel.org/r/20250821125555.3020951-1-yanquanmin1@huawei.com
Fixes: 1cd2430300 ("mm/damon/schemes: implement time quota")
Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com>
Reported-by: Andrew Paniakin <apanyaki@amazon.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: ze zuo <zuoze1@huawei.com>
Cc: <stable@vger.kernel.org>	[5.16+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-08-27 22:45:43 -07:00
..
tests mm/damon/core: add cleanup_target() ops callback 2025-07-19 18:59:56 -07:00
core.c mm/damon/core: prevent unnecessary overflow in damos_set_effective_quota() 2025-08-27 22:45:43 -07:00
Kconfig mm/damon: introduce DAMON_STAT module 2025-07-09 22:41:55 -07:00
lru_sort.c mm/damon/lru_sort: use damon_call() repeat mode instead of damon_callback 2025-07-19 18:59:55 -07:00
Makefile mm/damon: introduce DAMON_STAT module 2025-07-09 22:41:55 -07:00
modules-common.c mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
modules-common.h mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
ops-common.c mm/damon/ops-common: ignore migration request to invalid nodes 2025-07-24 19:12:43 -07:00
ops-common.h mm/damon: move folio filtering from paddr to ops-common 2025-07-19 18:59:50 -07:00
paddr.c mm/damon: move folio filtering from paddr to ops-common 2025-07-19 18:59:50 -07:00
reclaim.c mm/damon/reclaim: use damon_call() repeat mode instead of damon_callback 2025-07-19 18:59:54 -07:00
stat.c mm/damon/stat: use damon_call() repeat mode instead of damon_callback 2025-07-19 18:59:54 -07:00
sysfs-common.c mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
sysfs-common.h mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
sysfs-schemes.c mm/damon/sysfs-schemes: put damos dests dir after removing its files 2025-08-19 16:35:57 -07:00
sysfs.c mm/damon/sysfs: implement refresh_ms file internal work 2025-07-24 19:12:33 -07:00
vaddr.c mm/damon/vaddr: skip isolating folios already in destination nid 2025-08-02 12:06:09 -07:00