Re: [PATCH v2 2/2] arm64: mmu: avoid allocating pages while installing ng-mapping for KPTI

Yeoreum Yun
2025-12-17T19:24:26Z

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@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?

Thanks.

[...]

--
Sincerely,
Yeoreum Yun