linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Red Hat)" <david@kernel.org>
To: "Garg, Shivank" <shivankg@amd.com>, Matthew Wilcox <willy@infradead.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Zi Yan <ziy@nvidia.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Nico Pache <npache@redhat.com>,
	Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
	Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Zach O'Keefe <zokeefe@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	Branden Moore <Branden.Moore@amd.com>
Subject: Re: [PATCH 1/2] mm/khugepaged: do synchronous writeback for MADV_COLLAPSE
Date: Thu, 13 Nov 2025 16:30:27 +0100	[thread overview]
Message-ID: <0c9f5b83-10db-460f-bdee-897396b49838@kernel.org> (raw)
In-Reply-To: <e38e8059-a62b-4ad5-8316-5af02a0cc1b6@amd.com>

On 11.11.25 06:58, Garg, Shivank wrote:
> 
> 
> On 11/10/2025 7:58 PM, Matthew Wilcox wrote:
>> On Mon, Nov 10, 2025 at 07:50:17PM +0530, Garg, Shivank wrote:
>>> The issue is copying those binary to a freshly mounted filesystem.
>>> The page cache folios remain dirty until background writeback completes.
>>>
>>> Reproduces 100% for me: fresh XFS/EXT4 mount -> copy binary -> execute -> MADV_COLLAPSE fails.
>>
>> Yes, but this is an uncommon thing to do.  Really, it's the kind of
>> thing you do when you're testing something (like, whether ext4 supports
>> large folios, and whether that yields a performance improvement).
>> It's more reasonable to change userspace than the kernel to solve this
>> problem you're having.
> 
> Fair point.
> 
> You're right that this is primarily a testing scenario, though it may also
> potentially affect JIT compilers writing executables (also uncommon) but more
> research is needed.
> 
> For userspace workarounds, calling fsync() before MADV_COLLAPSE works.

Right. But do we want document that any caller of MADV_COLLAPSE should 
issue an fsync() if MADV_COLLAPSE fails to try again?

IMHO this just reveals a problem that might also be triggered in a 
container that just got downloaded or after upgrading a package, no?

-- 
Cheers

David


  reply	other threads:[~2025-11-13 15:30 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 11:32 Shivank Garg
2025-11-10 11:32 ` [PATCH 2/2] mm/khugepaged: return EAGAIN for transient dirty pages in MADV_COLLAPSE Shivank Garg
2025-11-10 11:56   ` Lorenzo Stoakes
2025-11-19 10:25     ` Garg, Shivank
2025-11-19 18:16       ` Lorenzo Stoakes
2025-11-20  7:03         ` Garg, Shivank
2025-11-10 13:46   ` Dev Jain
2025-11-19  7:00     ` Garg, Shivank
2025-11-10 12:01 ` [PATCH 1/2] mm/khugepaged: do synchronous writeback for MADV_COLLAPSE Lorenzo Stoakes
2025-11-10 13:07   ` Garg, Shivank
2025-11-10 13:22     ` Lorenzo Stoakes
2025-11-10 16:06       ` Lorenzo Stoakes
2025-11-10 16:55         ` Zi Yan
2025-11-10 19:40           ` Garg, Shivank
2025-11-10 19:48             ` Lorenzo Stoakes
2025-11-10 19:53               ` Lorenzo Stoakes
2025-11-10 21:16                 ` Lorenzo Stoakes
2025-11-10 21:56                   ` Zi Yan
2025-11-10 22:03                     ` Lorenzo Stoakes
2025-11-11  5:26                   ` Garg, Shivank
2025-11-10 13:24   ` Dev Jain
2025-11-10 13:36     ` Lorenzo Stoakes
2025-11-11  3:41       ` Dev Jain
2025-11-10 13:47 ` Matthew Wilcox
2025-11-10 13:52   ` Lorenzo Stoakes
2025-11-10 14:17     ` Matthew Wilcox
2025-11-10 14:20     ` Garg, Shivank
2025-11-10 14:23       ` Lorenzo Stoakes
2025-11-10 14:28       ` Matthew Wilcox
2025-11-11  5:58         ` Garg, Shivank
2025-11-13 15:30           ` David Hildenbrand (Red Hat) [this message]
2025-11-10 14:00   ` David Hildenbrand (Red Hat)
2025-11-10 14:03     ` Matthew Wilcox
2025-11-10 14:05       ` Lorenzo Stoakes
2025-11-10 14:54         ` David Hildenbrand (Red Hat)
2025-11-13 14:21 ` kernel test robot

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=0c9f5b83-10db-460f-bdee-897396b49838@kernel.org \
    --to=david@kernel.org \
    --cc=Branden.Moore@amd.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=dev.jain@arm.com \
    --cc=lance.yang@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=npache@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=ryan.roberts@arm.com \
    --cc=shivankg@amd.com \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.com \
    --cc=zokeefe@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