From: Xin Zhao <jackzxcui1989@163.com>
To: shakeel.butt@linux.dev
Cc: Liam.Howlett@oracle.com, akpm@linux-foundation.org,
axelrasmussen@google.com, david@kernel.org, hannes@cmpxchg.org,
harry.yoo@oracle.com, jackzxcui1989@163.com, jannh@google.com,
kuba@kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
lorenzo.stoakes@oracle.com, mhocko@kernel.org, riel@surriel.com,
vbabka@suse.cz, weixugc@google.com, willy@infradead.org,
yuanchu@google.com, zhengqi.arch@bytedance.com
Subject: Re: [PATCH] mm: vmscan: add skipexec mode not to reclaim pages with VM_EXEC vma flag
Date: Wed, 21 Jan 2026 11:40:00 +0800 [thread overview]
Message-ID: <20260121034000.51915-1-jackzxcui1989@163.com> (raw)
In-Reply-To: <aW__D24ZrpeSPKZN@linux.dev>
On Tue, 20 Jan 2026 14:20:23 -0800 Shakeel Butt <shakeel.butt@linux.dev> wrote:
> > 1. The reclaimed code segments are often those that handle exceptional
> > scenarios, which are not frequently executed. When memory pressure
> > increases, the entire system can become sluggish, leading to execution of
> > these seldom-used exception-handling code segments. Since these segments
> > are more likely to be reclaimed from memory, this exacerbates system
> > sluggishness.
> >
> > 2. The reclaimed code segments used for exception handling are often
> > shared by multiple tasks, causing these tasks to wait on the folio's
> > PG_locked bit, further increasing I/O wait.
> >
> > 3. Under memory pressure, the reclamation of code segments is often
> > scattered and randomly distributed, slowing down the efficiency of block
> > device reads and further exacerbating I/O wait.
> >
> > While this issue could be addressed by preloading a library mlock all
> > executable segments, it would lead to many code segments that are never
> > used being locked, resulting in memory waste.
> >
> > In systems where code execution is relatively fixed, preventing currently
> > in-use code segments from being reclaimed makes sense. This acts as a
> > self-adaptive way for the system to lock the necessary portions, which
> > saves memory compared to locking all code segments with mlock.
>
> Have you tried mlock2(MLOCK_ONFAULT) for your application? It will not
> bring in unaccessed segments into memory and only mlocks which is
> already in memory or accessed in future?
It's a good idea :) Thanks.
We may also try this solution in our project later.
--
Xin Zhao
prev parent reply other threads:[~2026-01-21 3:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 4:28 Xin Zhao
2026-01-16 8:20 ` Lorenzo Stoakes
2026-01-16 8:53 ` Xin Zhao
2026-01-20 22:20 ` Shakeel Butt
2026-01-21 3:40 ` Xin Zhao [this message]
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=20260121034000.51915-1-jackzxcui1989@163.com \
--to=jackzxcui1989@163.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=harry.yoo@oracle.com \
--cc=jannh@google.com \
--cc=kuba@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@kernel.org \
--cc=riel@surriel.com \
--cc=shakeel.butt@linux.dev \
--cc=vbabka@suse.cz \
--cc=weixugc@google.com \
--cc=willy@infradead.org \
--cc=yuanchu@google.com \
--cc=zhengqi.arch@bytedance.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