Re: [PATCH v2] mm: don't schedule deferred kernel page table freeing while booting
From: David Hildenbrand (Arm)
Date: Thu Sep 24 2026 - 14:58:25 EST
On 9/24/26 19:57, Dave Hansen wrote:
> On 9/24/26 02:23, Mikhail Gavrilov wrote:
>> Keep putting the table on the list, but don't schedule the work while
>> the system is still booting. The next kernel page table freed after
>> boot schedules it, and the work then frees the early table too, after
>> the same IOMMU flush as any other. If no kernel page table is freed
>> after boot, the ones freed during boot stay on the list.
>
> There seems to be an awful lot of chit chat about how and when the
> boot-time tables might get freed. Like:
>
>> So on this box the early tables wait until the first module is
>> loaded, and no separate drain is needed.
> Wouldn't a "separate drain" be all of 5 lines of code?
>
> /* Take care of deferred freeing from boot: */
> static __init int free_boot_kernel_pgtables(void)
> {
> schedule_work(&kernel_pgtable_work.work);
> }
> late_initcall(free_boot_kernel_pgtables);
>
> Then we don't have to reason about it at all.
Jup, that's what I hinted at in v1 and what Lorenzo replied to v2 as well.
(late_initcall vs. core_initcall)
--
Cheers,
David