From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Barry Song <baohua@kernel.org>,
kasong@tencent.com, qi.zheng@linux.dev, shakeel.butt@linux.dev,
axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com,
david@kernel.org, mhocko@kernel.org, ljs@kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: mglru: promote mapped executable folios after first usage
Date: Thu, 16 Jul 2026 12:06:27 +0800 [thread overview]
Message-ID: <201cee07-b4dc-4ee1-9d48-c01cb1c44a33@linux.alibaba.com> (raw)
In-Reply-To: <20260715124442.6002198725f60b2ffece2d97@linux-foundation.org>
On 7/16/26 3:44 AM, Andrew Morton wrote:
> On Wed, 15 Jul 2026 17:00:19 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:
>
>> I did a quick test with the same test case on my x86 machine, and I
>> still see an improvement in sys time.
>>
>> base patched
>> 1152.249s 993.235s
>
> Nice. Sashiko asked a thing:
> https://sashiko.dev/#/patchset/4b921ed528c483e13c9e22d1ae44ba58b4a15b0b.1784096432.git.baolin.wang@linux.alibaba.com
Thanks.
Forward Sashiko's comments:
"
This is a pre-existing issue, but does this miss promoting mapped
executable file folios during direct reclaim?
......
This means current->reclaim_state->mm_walk is NULL. When
shrink_folio_list() calls folio_referenced(), it invokes
lru_gen_look_around() which calls walk_update_folio() with a NULL walk.
Since walk is NULL, we fall back to lru_gen_set_refs() here, which
bypasses the newly patched folio_update_gen():
mm/vmscan.c:lru_gen_set_refs() {
if (!folio_test_referenced(folio) && !folio_test_workingset(folio)) {
set_mask_bits(&folio->flags.f, LRU_REFS_MASK, BIT(PG_referenced));
return false;
}
...
}
Because lru_gen_set_refs() lacks the new VMA_EXEC_BIT promotion logic,
it merely sets PG_referenced without updating the folio's generation.
When those adjacent folios are subsequently isolated by
shrink_folio_list(), their PTE young bits have already been cleared,
causing folio_check_references() to return FOLIOREF_RECLAIM and evict
them. Will we need a similar fix for lru_gen_set_refs() to handle direct
reclaim paths?
"
During aging, MGLRU always sets up a valid mm_walk to walk the page
table access flags in try_to_inc_max_seq().
When aging is not needed, it is indeed possible to fall into
lru_gen_set_refs() and miss promoting mapped exec folios after first
usage. Although I think the impact is limited, because after the current
patch, accessed mapped exec folios rarely get a chance to enter the
eviction path. Anyway, I'll add promotion logic for lru_gen_set_refs().
next prev parent reply other threads:[~2026-07-16 4:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 6:33 Baolin Wang
2026-07-15 6:52 ` Barry Song
2026-07-15 6:58 ` Baolin Wang
2026-07-15 7:54 ` Barry Song
2026-07-15 7:57 ` Barry Song
2026-07-15 9:00 ` Baolin Wang
2026-07-15 19:44 ` Andrew Morton
2026-07-16 4:06 ` Baolin Wang [this message]
2026-07-15 16:50 ` Kairui Song
2026-07-16 2:30 ` Baolin Wang
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=201cee07-b4dc-4ee1-9d48-c01cb1c44a33@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=david@kernel.org \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@kernel.org \
--cc=qi.zheng@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=weixugc@google.com \
--cc=yuanchu@google.com \
/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