From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Pedro Falcato <pfalcato@suse.de>,
"Liam R. Howlett" <liam@infradead.org>,
David Hildenbrand <david@kernel.org>,
Jann Horn <jannh@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Mike Kaplinskiy <mike@recall.ai>,
zhaozhengzhuo <zhaozhengzhuo@uniontech.com>
Subject: Re: [PATCH] mm/madvise: swap in CoW'd MAP_PRIVATE-file mappings on MADV_WILLNEED
Date: Mon, 7 Sep 2026 17:09:34 +0200 [thread overview]
Message-ID: <55ce7bee-c0e0-4051-8bc4-26cf3aa3f7e9@kernel.org> (raw)
In-Reply-To: <ap6u6Ana3MvvIIUe@gremlin>
On 9/7/26 14:32, Lorenzo Stoakes (ARM) wrote:
> On Sat, Sep 05, 2026 at 05:17:57PM -0700, Andrew Morton wrote:
>> On Fri, 4 Sep 2026 17:01:37 +0100 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:
>>
>> > Andrew - could you swap the patch out in-place with below? Thanks!
>> >
>>
>> np.
>>
>> > Currently MADV_WILLNEED treats file-backed and pure anonymous mappings
>> > entirely separately - using POSIX_FADV_WILLNEED (equivalent of a readahead)
>> > for the former and a tree walk and swap in to swap cache for the latter.
>> >
>> > MAP_PRIVATE-file backed mappings straddle the two and currently get treated
>> > as if they were purely file-backed, meaning any swapped out private pages
>> > remain swapped out.
>> >
>> > Resolve the issue by explicitly checking for CoW'd MAP_PRIVATE-file backed
>> > mappings and performing both walks in this case.
>> >
>> > Since the logic checks for vma->anon_vma this means un-CoW'd
>> > MAP_PRIVATE-file backed mappings retain only the single file walk.
>> >
>> > Reported-by: Mike Kaplinskiy <mike@recall.ai>
>> > Closes: https://lore.kernel.org/all/CABeknB_S2XJSHFgnHdgnN0rjzHhH4oQJs_APq9fvxHztQ_pgiA@mail.gmail.com/
>> > Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
>>
>> The failure mode looks pretty obscure, so I'm thinking that no backport
>> is needed.
>
> Well it's not even really a failure mode so much as a 'known limitation' :)
> So yeah agreed.
Yeah, as we know madvise() just an advice after all, the kernel is free to
ignore it :)
(MADV_DONTNEED and friends enter the chat)
> --
> Cheers, Lorenzo
next prev parent reply other threads:[~2026-09-07 15:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 15:12 Lorenzo Stoakes (ARM)
2026-09-04 15:24 ` Pedro Falcato
2026-09-04 16:01 ` Lorenzo Stoakes (ARM)
2026-09-06 0:17 ` Andrew Morton
2026-09-07 12:32 ` Lorenzo Stoakes (ARM)
2026-09-07 15:09 ` Vlastimil Babka (SUSE) [this message]
2026-09-07 15:27 ` Lorenzo Stoakes (ARM)
2026-09-07 11:51 ` David Hildenbrand (Arm)
2026-09-07 12:33 ` Lorenzo Stoakes (ARM)
2026-09-07 12:39 ` Pedro Falcato
2026-09-07 15:05 ` Vlastimil Babka (SUSE)
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=55ce7bee-c0e0-4051-8bc4-26cf3aa3f7e9@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mike@recall.ai \
--cc=pfalcato@suse.de \
--cc=zhaozhengzhuo@uniontech.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
all inboxes | Powered by JetHome®