From: SJ Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Aveline Noir <jm5905938@gmail.com>, SJ Park <sj@kernel.org>,
damon@lists.linux.dev, linux-mm@kvack.org,
Enze Li <lienze@kylinos.cn>
Subject: [PATCH 1/4] mm/damon/paddr: skip non-LRU folios as a whole in pageout
Date: Tue, 24 Nov 2026 07:30:17 -0800 [thread overview]
Message-ID: <20261124153021.90142-2-sj@kernel.org> (raw)
In-Reply-To: <20261124153021.90142-1-sj@kernel.org>
From: Aveline Noir <jm5905938@gmail.com>
damon_pa_pageout() uses damon_get_folio(), which rejects folios that are
not on the LRU. For a large non-LRU folio such as a hugetlb folio, the
loop then looks up the same folio once per base page even though
pageout cannot reclaim it.
Use damon_get_monitor_folio() and skip any returned non-LRU folio as a
whole by advancing to its end. Do this before the filters, the
accounting and the last_applied check, so that adjacent regions within
the same non-LRU folio are not walked by base page either.
In an x86-64 KVM pageout microbenchmark, traversal time dropped by
about 99.7% for regions covering whole 2 MiB hugetlb folios. For
4 KiB regions within hugetlb folios, traversal took about 1 ns more
per region.
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
Reviewed-by: Enze Li <lienze@kylinos.cn>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Changes from v2
- v2: https://lore.kernel.org/20261118-fix-damon-hugetlb-pageout-20261117-v2-1-547a65a3206e@gmail.com
- Collect R-b: from Enze and SJ.
- Rebase to the latest mm-new.
Changes in v2:
- v1: https://lore.kernel.org/20261117-fix-damon-hugetlb-pageout-20261117-v1-1-054ef8760a92@gmail.com
- Drop the redundant hugetlb check and update the subject and
description as suggested by SJ.
mm/damon/paddr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 411e1d557ba3f..83bc173c30504 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -268,7 +268,9 @@ static unsigned long damon_pa_pageout(struct damon_region *r,
addr = damon_pa_phys_addr(r->ar.start, addr_unit);
while (addr < damon_pa_phys_addr(r->ar.end, addr_unit)) {
- folio = damon_get_folio(PHYS_PFN(addr));
+ folio = damon_get_monitor_folio(PHYS_PFN(addr));
+ if (folio && !folio_test_lru(folio))
+ goto put_folio;
if (damon_pa_invalid_damos_folio(folio, s)) {
addr += PAGE_SIZE;
continue;
--
2.47.3
next prev parent reply other threads:[~2026-11-24 15:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 15:30 [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit SJ Park
2026-11-24 15:30 ` SJ Park [this message]
2026-11-24 17:16 ` + mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch added to mm-new branch Andrew Morton
2026-11-24 15:30 ` [PATCH 2/4] mm/damon/core: skip apply_probes() when no probes are installed SJ Park
2026-11-24 17:16 ` + mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch added to mm-new branch Andrew Morton
2026-11-24 15:30 ` [PATCH 3/4] selftests/damon/damos_quota: skip the last sample when counting exceeds SJ Park
2026-11-24 17:16 ` + selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch added to mm-new branch Andrew Morton
2026-11-24 15:30 ` [PATCH 4/4] mm/damon/tests/core-kunit: add test for damon_call() SJ Park
2026-11-24 17:16 ` + mm-damon-tests-core-kunit-add-test-for-damon_call.patch added to mm-new branch Andrew Morton
2026-11-24 15:39 ` [PATCH 0/4] mm/damon: improve efficiency (paddr, core), fix a selftest, add a kunit sashiko-bot
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=20261124153021.90142-2-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=jm5905938@gmail.com \
--cc=lienze@kylinos.cn \
--cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.