From: SeongJae Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SeongJae Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [RFC PATCH 2/7] mm/damon/reclaim: cover all system rams
Date: Tue, 14 Apr 2026 20:47:32 -0700 [thread overview]
Message-ID: <20260415034734.83189-1-sj@kernel.org> (raw)
In-Reply-To: <20260415015830.5F43DC19425@smtp.kernel.org>
On Wed, 15 Apr 2026 01:58:29 +0000 sashiko-bot@kernel.org wrote:
> Sashiko AI review found 3 potential issue(s):
> - [High] Unbounded iteration over physical memory holes causes severe scheduling latency and soft lockups.
> - [High] Inclusion of physical holes permanently exhausts DAMOS quotas and starves actual memory reclaim.
> - [High] Bounding box over sparse memory dilutes sampling accuracy and traps RAM in cold regions.
I don't think none of these are real issues for this patch. See below for more
detailed answers.
> --
>
> commit 1ebe17b8690373c96bc931bcacccad9cbc735e44
> Author: SeongJae Park <sj@kernel.org>
>
> mm/damon/reclaim: cover all system rams
>
> This commit changes the default DAMON_RECLAIM monitoring region from the
> biggest System RAM resource to a single bounding box that spans all System
> RAM resources on the system.
>
> > diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c
> > index 86da147786583..2a2343d751f3e 100644
> > --- a/mm/damon/reclaim.c
> > +++ b/mm/damon/reclaim.c
> [ ... ]
> > @@ -242,11 +244,9 @@ static int damon_reclaim_apply_parameters(void)
> > damos_add_filter(scheme, filter);
> > }
> >
> > - err = damon_set_region_biggest_system_ram_default(param_target,
> > - &monitor_region_start,
> > - &monitor_region_end,
> > - param_ctx->addr_unit,
> > - param_ctx->min_region_sz);
> > + err = damon_set_region_system_rams_default(param_target,
> > + &monitor_region_start, &monitor_region_end,
> > + param_ctx->addr_unit, param_ctx->min_region_sz);
>
> When using a single bounding box that covers all System RAM, does this
> introduce large physical address holes (like PCIe MMIO gaps) into the
> monitored region? On sparse NUMA topologies, these holes can be terabytes
> in size.
>
> If operations like DAMOS_PAGEOUT iterate linearly over the region
> page-by-page, will they process these massive holes? For physical holes,
> damon_get_folio() will return NULL, and the loop might continue without
> yielding:
>
> damon_pa_pageout() {
> ...
> while (addr < end) {
> ...
> folio = damon_get_folio(PHYS_PFN(addr));
> if (!folio) {
> addr += PAGE_SIZE;
> continue;
> }
> ...
> }
> }
>
> Since cond_resched() is often placed outside or after such loops, could this
> continuous iteration over unbacked holes trigger soft lockups and severe
> scheduling latency?
Theoretically that's possible. But I believe damon_get_folio() should be
lighweight enough to not cause such problems in common cases. Also, we allow
users to manually set the monitoring regions for special cases.
So unless this cause such real issues in common cases, I think this patch is
good to go as is.
>
> How does the inclusion of massive physical holes interact with DAMOS quotas?
>
> In damos_apply_scheme(), the scheme's charged size is incremented by the
> evaluated region size (quota->charged_sz += sz). If regions span terabytes of
> unbacked holes, evaluating them will quickly exhaust the quota (e.g., 128
> MiB/sec for DAMON_RECLAIM) without reclaiming any actual pages.
>
> Could this starve actual memory reclaim and inflate the sz_tried statistics?
Yes, this could exhaust the quota. But, again, users can manually set the
regions if this becomes a real problem on their setup. We are also working on
the action failed regions quota charge ratio [1], which could also help the
corner case.
>
> Does the bounding box approach also affect sampling accuracy?
>
> DAMON samples a random address within a region using
> damon_rand(r->ar.start, r->ar.end). If the region is mostly composed of
> physical holes, the sample will frequently land in unbacked space and return
> zero accesses.
>
> Since the region will continuously appear cold, could
> damon_merge_two_regions() merge it with adjacent valid RAM regions? This
> might trap valid RAM inside massive cold regions, diluting the sampling
> probability for actual memory.
Adaptive regions adjustment should avoid things going on such extreme case.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260415012048.76508-1-sj@kernel.org?part=2
[1] https://lore.kernel.org/20260412161957.82835-1-sj@kernel.org
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-04-15 3:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 1:20 [RFC PATCH 0/7] mm/damon/reclaim,lru_sort: monitor all system rams by default SeongJae Park
2026-04-15 1:20 ` [RFC PATCH 1/7] mm/damon: introduce damon_set_region_system_rams_default() SeongJae Park
2026-04-15 1:35 ` sashiko-bot
2026-04-15 3:36 ` SeongJae Park
2026-04-15 1:20 ` [RFC PATCH 2/7] mm/damon/reclaim: cover all system rams SeongJae Park
2026-04-15 1:58 ` sashiko-bot
2026-04-15 3:47 ` SeongJae Park [this message]
2026-04-15 1:20 ` [RFC PATCH 3/7] mm/damon/lru_sort: " SeongJae Park
2026-04-15 2:36 ` sashiko-bot
2026-04-15 3:52 ` SeongJae Park
2026-04-15 1:20 ` [RFC PATCH 4/7] mm/damon/core: remove damon_set_region_biggest_system_ram_default() SeongJae Park
2026-04-15 1:20 ` [RFC PATCH 5/7] mm/damon/stat: use damon_set_region_system_rams_default() SeongJae Park
2026-04-15 1:20 ` [RFC PATCH 6/7] Docs/admin-guide/mm/damon/reclaim: update for entire memory monitoring SeongJae Park
2026-04-15 1:20 ` [RFC PATCH 7/7] Docs/admin-guide/mm/damon/lru_sort: " SeongJae Park
2026-04-15 2:57 ` sashiko-bot
2026-04-15 3:53 ` SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260415034734.83189-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-bot@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox