[RFC PATCH 1/3] mm: make persistent huge zero folio read-only

David Hildenbrand (Arm) david at kernel.org
Mon Jun 1 06:49:00 PDT 2026


On 5/27/26 17:55, Dave Hansen wrote:
> On 5/26/26 20:56, Xueyuan chen wrote:> +#ifdef
> CONFIG_READONLY_HUGE_ZERO_FOLIO
>> +bool __init arch_make_huge_zero_folio_readonly(struct folio *folio);
>> +#endif
> 
> All of the #ifdeffery needs to die, IMNHO.
> 
> This function is also a bad idea. There is nothing "huge zero" specific
> about it. It takes any old folio and tries to make it read only.
> 
> Just make it:
> 
> 	bool __init arch_make_folio_readonly(struct folio *folio)
> 

I'm not sure whether we want a folio-based interface, though.

This will likely be the only folio (that will actually have a "struct folio" in
the future) compound page we'll ever mark read-only ... whereby I'd guess we'd
want other non-folio pages to be read-only in the future (encryption keys etc,
maybe?).

So I'd instead use a page-range based interface or sth like that.

-- 
Cheers,

David



More information about the linux-arm-kernel mailing list