[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <338bc820-3e43-4da6-b09e-936bf55f657f@redhat.com>
Date: Tue, 17 Jun 2025 20:25:40 +0200
From: David Hildenbrand <david@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
nvdimm@...ts.linux.dev, Andrew Morton <akpm@...ux-foundation.org>,
Juergen Gross <jgross@...e.com>, Stefano Stabellini
<sstabellini@...nel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
Dan Williams <dan.j.williams@...el.com>, Alistair Popple
<apopple@...dia.com>, Matthew Wilcox <willy@...radead.org>,
Jan Kara <jack@...e.cz>, Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Zi Yan <ziy@...dia.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>, Nico Pache <npache@...hat.com>,
Ryan Roberts <ryan.roberts@....com>, Dev Jain <dev.jain@....com>,
Barry Song <baohua@...nel.org>, Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...nel.org>, Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>, Jann Horn <jannh@...gle.com>,
Pedro Falcato <pfalcato@...e.de>
Subject: Re: [PATCH RFC 00/14] mm: vm_normal_page*() + CoW PFNMAP improvements
On 17.06.25 18:18, David Hildenbrand wrote:
> On 17.06.25 17:43, David Hildenbrand wrote:
>> RFC because it's based on mm-new where some things might still change
>> around the devmap removal stuff.
>>
>> While removing support for CoW PFNMAPs is a noble goal, I am not even sure
>> if we can remove said support for e.g., /dev/mem that easily.
>>
>> In the end, Cow PFNMAPs are pretty simple: everything is "special" except
>> CoW'ed anon folios, that are "normal".
>>
>> The only complication is: how to identify such pages without pte_special().
>> Because with pte_special(), it's easy.
>>
>> Well, of course, one day all architectures might support pte_special() ...
>> either because we added support for pte_special() or removed support for
>> ... these architectures from Linux.
>>
>> No need to wait for that day. Let's do some cleanups around
>> vm_normal_page()/vm_normal_page_pmd() and handling of the huge zero folio,
>> and remove the "horrible special case to handle copy-on-write behaviour"
>> that does questionable things in remap_pfn_range() with a VMA, simply by
>>
>> ... looking for anonymous folios in CoW PFNMAPs to identify anonymous
>> folios? I know, sounds crazy ;)
>
> I'll mention one corner case that just occurred to me: assume someone
> maps arbitrary /dev/mem that is actually used by the kernel for user
> space, and then some of that memory gets allocated as anonymous memory,
> it would probably be a problem.
>
> Hmm, I'll have to think about that, and the interaction with
> CONFIG_STRICT_DEVMEM.
The /dev/mem mapping of arbitrary memory is indeed the hard case. To
handle all that, patch #11 is too simplistic.
I have some idea how to make it work, but have to think about a couple
of corner cases.
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists