[RFC PATCH 1/3] mm: make persistent huge zero folio read-only
Xueyuan Chen
xueyuan.chen21 at gmail.com
Wed May 27 16:03:14 PDT 2026
On Wed, May 27, 2026 at 07:02:55PM +0530, Dev Jain wrote:
[...]
>> static atomic_t huge_zero_refcount;
>> +#ifdef CONFIG_READONLY_HUGE_ZERO_FOLIO
>> +struct folio *huge_zero_folio __ro_after_init;
>
>
>Can we guard this with CONFIG_PERSISTENT_HUGE_ZERO_FOLIO? Since
>in that case too the pointer is never written after init.
>
Yes, that makes sense. The pointer lifetime is tied to
CONFIG_PERSISTENT_HUGE_ZERO_FOLIO. I'll fix this in v2.
>>
>> +#ifdef CONFIG_READONLY_HUGE_ZERO_FOLIO
>> +static bool __init make_huge_zero_folio_readonly(void)
>> +{
>> + return arch_make_huge_zero_folio_readonly(READ_ONCE(huge_zero_folio));
>
>
>I think READ_ONCE is not required since no one is going to change the
>pointer after allocation?
>
Agreed, READ_ONCE is not needed here. I'll drop it in v2.
Thanks,
Xueyuan
More information about the linux-arm-kernel
mailing list