[PATCH v2 2/2] arm64: mmu: avoid allocating pages while installing ng-mapping for KPTI
Ryan Roberts
ryan.roberts at arm.com
Thu Dec 18 00:34:01 PST 2025
On 17/12/2025 19:09, Yeoreum Yun wrote:
> Hi Ryanc,
>
> [...]
>>> - if (!cpu) {
>>> - free_pages(alloc, order);
>>> + if (!cpu)
>>> arm64_use_ng_mappings = true;
>>> - }
>>>
>>> return 0;
>>> }
>>>
>>> void __init kpti_install_ng_mappings(void)
>>> {
>>> + int order = order_base_2(CONFIG_PGTABLE_LEVELS);
>>> + u64 alloc;
>>> +
>>> /* Check whether KPTI is going to be used */
>>> if (!arm64_kernel_unmapped_at_el0())
>>> return;
>>> @@ -1436,8 +1434,14 @@ void __init kpti_install_ng_mappings(void)
>>> if (arm64_use_ng_mappings)
>>> return;
>>>
>>> + alloc = __get_free_pages(GFP_ATOMIC | __GFP_ZERO, order);
>>
>> I don't think this requires GFP_ATOMIC now?
>>
>> With that removed:
>>
>> Reviewed-by: Ryan Roberts <ryan.roberts at arm.com>
>
> I think it would be better to use only __GFP_HIGH in here since
> when kpti_install_ng_mappings() is called, "kswpd" doesn't created yet.
> and to allocate page with assurance, It would be good to use
> min_reserved to.
>
> Am I missing something?
Personally I think we should just use "GFP_KERNEL | __GFP_ZERO". Anything else
would make this allocation look special, which it is not. If we fail to allocate
at this point in boot, we have bigger problems.
>
> Thanks.
>
> [...]
>
> --
> Sincerely,
> Yeoreum Yun
More information about the linux-arm-kernel
mailing list