[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aDc23-d2fsQbdIKe@x1.local>
Date: Wed, 28 May 2025 12:16:31 -0400
From: Peter Xu <peterx@...hat.com>
To: Oscar Salvador <osalvador@...e.de>
Cc: David Hildenbrand <david@...hat.com>, Gavin Guo <gavinguo@...lia.com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
muchun.song@...ux.dev, akpm@...ux-foundation.org,
mike.kravetz@...cle.com, kernel-dev@...lia.com,
stable@...r.kernel.org, Hugh Dickins <hughd@...gle.com>,
Florent Revest <revest@...gle.com>, Gavin Shan <gshan@...hat.com>
Subject: Re: [PATCH v3] mm/hugetlb: fix a deadlock with pagecache_folio and
hugetlb_fault_mutex_table
On Wed, May 28, 2025 at 05:45:42PM +0200, Oscar Salvador wrote:
> I thought the main reason was because PageLock protects us against writes,
> so when copying (in case of copying the underlying file), we want the
> file to be stable throughout the copy?
The folio can already been mapped writable in other VM_SHARED vmas.. which
means the userspace is free to write whatever while kernel copying, right?
IIUC there's no way to make sure the folio content is stable as long as it
can be mapped, CoW should just happen and the result of the copied page is
unpredictable if there're concurrent writes.
IMHO it's the userspace's job if it wants to make sure the folio (when
triggering CoW) copies a stable piece of content.
That's also why I was thinking maybe we don't need the folio lock at all.
We still will need a refcount though for the pagecache to make sure it
wont' get freed concurrently.
Thanks,
--
Peter Xu
Powered by blists - more mailing lists