[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aW__D24ZrpeSPKZN@linux.dev>
Date: Tue, 20 Jan 2026 14:20:23 -0800
From: Shakeel Butt <shakeel.butt@...ux.dev>
To: Xin Zhao <jackzxcui1989@....com>
Cc: akpm@...ux-foundation.org, david@...nel.org,
lorenzo.stoakes@...cle.com, riel@...riel.com, Liam.Howlett@...cle.com, vbabka@...e.cz,
harry.yoo@...cle.com, jannh@...gle.com, willy@...radead.org, axelrasmussen@...gle.com,
yuanchu@...gle.com, weixugc@...gle.com, hannes@...xchg.org, mhocko@...nel.org,
zhengqi.arch@...edance.com, kuba@...nel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] mm: vmscan: add skipexec mode not to reclaim pages with
VM_EXEC vma flag
On Fri, Jan 16, 2026 at 12:28:17PM +0800, Xin Zhao wrote:
> For some embedded systems, .text segments are often fixed. In situations
> of high memory pressure, these fixed segments may be reclaimed by the
> system, leading to iowait when these segments will be used again.
> The iowait problem becomes even more severe due to the following reasons:
>
> 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?
Powered by blists - more mailing lists