From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796322709; b=KIrhoFWRk22ny7TzMj26zyMGAjjyyLDxnudno8xhG/LYuLsGnbruMQkkUM1LWCXXHvaA h0/38O+KSUNPniI6Jf1KuZNFQTQK6a6mCZtNQuC3qT4pprF1wUjY0DBZ52/gUE7Z25CXl tzTgodn5AtR7Ge6lV5nn0Ss1DRZfuYgU2T6reOGM6MinAnM+EIMRSeZ3SlgOU1/1xruhN u74RhfoeWSrLaQcgFRNVqEXcBc2uXlXSQ76BptOsGr4IdewvR98ymRyEGZfpuvofJIG7r chiMs6VTQ+fz4PpqDkFjLAwaoc2k0y2HOjE36SqmtnmyYwQpj44I0+Xe9USlxydkNzQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796322709; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=QDIEbWBUEJzarVM2sQeYyUxNhEsQ+z6Eo1f7VRv/44o=; b=xjvSMoNpS77X3rYVJ4D4Z3KTuvasAjnn/CaF9wX/5qE+Bo8QDqX3e/CjyZxRyT0saf3l BybFdyGH/XKowSUEhT3XCNf3qpSdVhhtEoY7w/v44M8FqUoMwIh1OpuQt45n8S+AFhvx6 HruzmG0uf3Nmbv0SADBxgHvb026dNPCPpFFIzWepnucuuXMszdaildfHImhhj7xanBdhC PuDigdj+A6xHyMF4SA7MU5BcdDYAYLnUpp3c2liYTiy6/Hh8Ys56DE+GDbjL+qvKu/grS YycmMOPxp1lKo0mRveIdixb9FryLYZ9WE2fHhCha6LDwy+Zj68kY2P4bRLJXjXNVh6A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=iXmYUwH7; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8B96606A322 for ; Thu, 3 Dec 2026 18:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=iXmYUwH7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 579E61F000C1; Thu, 3 Dec 2026 18:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796322709; bh=QDIEbWBUEJzarVM2sQeYyUxNhEsQ+z6Eo1f7VRv/44o=; h=Date:To:From:In-Reply-To:References:Subject; b=iXmYUwH7VSzNgDZEAAoiP3uaBtR8RvhuPoL2IkObxEj15Tzi8UbiCWyqTCdHcIMoa lZllSrY1APW/nhYrrkmaTVJleBNaUuCElT3Nhfdu9O9KIPLkK9fcmkdiLDwY6kyVjq VtgO8H3IgqiAS0rhUsgX7oYgRjYzrlEAZoSTpMoY= Date: Thu, 03 Dec 2026 10:31:48 -0800 To: mm-commits@vger.kernel.org,sj@kernel.org,lienze@kylinos.cn, arijit.desai@crusoe.ai,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261203153215.733163-3-sj@kernel.org> References: <20261203153215.733163-3-sj@kernel.org> Subject: + mm-damon-reclaim-use-age_ms-filter-for-min_age.patch added to mm-new branch Message-Id: <20261203183149.579E61F000C1@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/damon/reclaim: use age_ms filter for min_age has been added to the -mm mm-new branch. Its filename is mm-damon-reclaim-use-age_ms-filter-for-min_age.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-reclaim-use-age_ms-filter-for-min_age.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Arijit Desai Subject: mm/damon/reclaim: use age_ms filter for min_age Date: Thu, 03 Dec 2026 07:32:14 -0800 DAMON_RECLAIM converts its min_age parameter (in microseconds) into DAMOS min_age_region, which is in aggregation intervals, once when the parameters are applied. When autotune_monitoring_intervals is enabled, the conversion uses the initial 100 ms aggregation interval, but the auto-tuning soon grows the interval. The region age threshold therefore stays at the same number of aggregation intervals while each interval becomes much longer. For the default min_age of 120 seconds, the threshold becomes 1,200 aggregation intervals, which is about 2.5 hours once the aggregation interval grows to about 7.5 seconds. As a result, DAMON_RECLAIM reclaims almost nothing [1] in that setup. Use a DAMOS_FILTER_TYPE_AGE_MS filter that rejects regions younger than min_age instead, and set min_age_region to zero. The filter compares the region age converted with the current aggregation interval, so it stays correct while the intervals change. For fixed intervals, the behavior is unchanged. Regions rejected by the filter are not charged to the quota and do not count as tried regions. Keep accepting any min_age, as before. If min_age is smaller than a millisecond, add no filter, so every region is old enough. Tested on a 16 vCPU / 62 GiB VM with a cold anonymous buffer plus 1 GiB of hot anonymous memory, autotune_monitoring_intervals=Y, min_age=120 s and watermarks forced active: kernel cold buffer 10 min result unpatched 8 GiB no region tried, nothing paged out unpatched 48 GiB no region tried, nothing paged out patched 48 GiB nothing paged out before 181 s, then steady pageout (~1 GiB swapped out by 600 s, limited by the time quota) The same age_ms filter based min_age was also tested with a DAMOS pageout scheme set up via the DAMON sysfs interface, on a vLLM CPU inference workload (3B model, 32 concurrent users, intervals auto-tuning, min_age 120 s, 4 runs per setup). Compared to no DAMON, it reduced the vLLM worker's resident memory by about 1.8 GiB (of 18.4 GiB), at a cost of 0.2% output throughput and 0.3% inter-token latency. With the classic LRU instead of MGLRU, it reduced 1.55 GiB at 0.1% throughput and 0.1% latency cost. The same scheme with min_age converted to aggregation intervals once, as DAMON_RECLAIM does now, reduced only 0.06 GiB. Link: https://patch.msgid.link/20261203153215.733163-3-sj@kernel.org Link: https://lore.kernel.org/20261121015324.83753-1-sj@kernel.org [1] Signed-off-by: Arijit Desai Signed-off-by: SJ Park Signed-off-by: Andrew Morton Reviewed-by: SJ Park Cc: Enze Li mm/damon/reclaim.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) --- a/mm/damon/reclaim.c~mm-damon-reclaim-use-age_ms-filter-for-min_age +++ a/mm/damon/reclaim.c @@ -164,7 +164,7 @@ DEFINE_DAMON_MODULES_DAMOS_STATS_PARAMS( static struct damon_ctx *ctx; static struct damon_target *target; -static struct damos *damon_reclaim_new_scheme(unsigned long aggr_interval) +static struct damos *damon_reclaim_new_scheme(void) { struct damos_access_pattern pattern = { /* Find regions having PAGE_SIZE or larger size */ @@ -173,8 +173,8 @@ static struct damos *damon_reclaim_new_s /* and not accessed at all */ .min_nr_accesses = 0, .max_nr_accesses = 0, - /* for min_age or more micro-seconds */ - .min_age_region = min_age / aggr_interval, + /* min_age is applied via a DAMOS_FILTER_TYPE_AGE_MS filter */ + .min_age_region = 0, .max_age_region = UINT_MAX, }; @@ -227,7 +227,7 @@ static int damon_reclaim_apply_parameter goto out; err = -ENOMEM; - scheme = damon_reclaim_new_scheme(attrs.aggr_interval); + scheme = damon_reclaim_new_scheme(); if (!scheme) goto out; damon_set_schemes(param_ctx, &scheme, 1); @@ -249,6 +249,16 @@ static int damon_reclaim_apply_parameter damos_add_quota_goal(&scheme->quota, goal); } + if (min_age >= USEC_PER_MSEC) { + filter = damos_new_filter(DAMOS_FILTER_TYPE_AGE_MS, true, + false); + if (!filter) + goto out; + filter->range_min = 0; + filter->range_max = min_age / USEC_PER_MSEC - 1; + damos_add_filter(scheme, filter); + } + if (skip_anon) { filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true, false); if (!filter) _ Patches currently in -mm which might be from arijit.desai@crusoe.ai are mm-damon-reclaim-use-age_ms-filter-for-min_age.patch