mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Barry Song <baohua@kernel.org>
Cc: akpm@linux-foundation.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: Wed, 15 Jul 2026 17:00:19 +0800	[thread overview]
Message-ID: <0fdd8922-3087-4636-aa5d-27074462fa6d@linux.alibaba.com> (raw)
In-Reply-To: <CAGsJ_4wvFAJ8efiBUdAVwU-L4iS_t2NsQDWnssmK0UbqbdnM+Q@mail.gmail.com>



On 7/15/26 3:57 PM, Barry Song wrote:
> On Wed, Jul 15, 2026 at 3:54 PM Barry Song <baohua@kernel.org> wrote:
> [...]
>>>>
>>>> Hi Baolin,
>>>>
>>>> Because ARM doesn't set the surrounding PTEs to young, while x86
>>>> may behave differently and mark the surrounding PTEs as young as
>>>> well. Could we also collect the data on x86?
>>>>
>>>> void set_pte_range(struct vm_fault *vmf, struct folio *folio,
>>>>                   struct page *page, unsigned int nr, unsigned long addr)
>>>> {
>>>>           ...
>>>>
>>>>           if (prefault && arch_wants_old_prefaulted_pte())
>>>>                   entry = pte_mkold(entry);
>>>>           else
>>>>                   entry = pte_sw_mkyoung(entry);
>>>
>>> Sure. But I don't think it's very relevant to this point. MGLRU doesn't
>>> protect normally accessed mmaped exec file folios well enough. Anyway,
>>> I'll test it on x86.
>>
>> My point is that even mmaped executable folios that have never been
>> accessed might still get promoted because they already have the accessed
>> bit set. :-)
> 
> Second thought: we don't do much readahead for VM_EXEC since it is
> considered random access. So maybe I am being over-cautious here.
> The data will tell us :-)

Yes. Besides, even if an exec folio gets promoted incorrectly at first, 
it can still be reclaimed as it ages without further accesses. This is 
the same logic as the classical LRU.

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

  reply	other threads:[~2026-07-15  9:00 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 [this message]
2026-07-15 19:44           ` Andrew Morton
2026-07-16  4:06             ` Baolin Wang
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=0fdd8922-3087-4636-aa5d-27074462fa6d@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

Powered by JetHome