From: SeongJae Park Date: Tue, 16 Sep 2025 03:23:36 +0000 (-0700) Subject: mm/damon/core: set effective quota on first charge window X-Git-Tag: v6.18-rc1~130^2~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac93e87c66fd30b6cf328591ea0f09321ab98fac;p=thirdparty%2Fkernel%2Fstable.git mm/damon/core: set effective quota on first charge window The effective quota of a scheme is initialized zero, which means there is no quota. It is set based on user-specified time/quota/quota goals. But the later value set is done only from the second charge window. As a result, a scheme having a user-specified quota can work as not having the quota (unexpectedly fast) for the first charge window. In practical and common use cases the quota interval is not too long, and the scheme's target access pattern is restrictive. Hence the issue should be modest. That said, it is apparently an unintended misbehavior. Fix the problem by setting esz on the first charge window. Link: https://lkml.kernel.org/r/20250916032339.115817-3-sj@kernel.org Fixes: 1cd243030059 ("mm/damon/schemes: implement time quota") # 5.16.x Signed-off-by: SeongJae Park Cc: David Hildenbrand Cc: Jonathan Corbet Cc: Joshua Hahn Cc: Liam Howlett Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- diff --git a/mm/damon/core.c b/mm/damon/core.c index ff2c6bb306210..775121ae7a9bc 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2142,8 +2142,10 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s) return; /* First charge window */ - if (!quota->total_charged_sz && !quota->charged_from) + if (!quota->total_charged_sz && !quota->charged_from) { quota->charged_from = jiffies; + damos_set_effective_quota(quota); + } /* New charge window starts */ if (time_after_eq(jiffies, quota->charged_from +