Re: [PATCH v2 02/15] mm: pgtable: introduce generic p4d_alloc_one() and p4d_free()

From: Qi Zheng
Date: Thu Dec 19 2024 - 22:19:34 EST


Hi Alexander,

On 2024/12/20 00:32, Alexander Gordeev wrote:
On Wed, Dec 18, 2024 at 09:04:38PM +0800, Qi Zheng wrote:
For these architectures, provide a generic implementation in
asm-generic/pgalloc.h and convert them to use it. And like other levels
of page tables, add statistics for P4D level page table.

FWIW, introducing the generic implementation and adding ctor|dtors
look as separate changes to me.

OK, will separate it in v3.


...
static inline void p4d_free(struct mm_struct *mm, p4d_t *p4d)
{
- if (!pgtable_l5_enabled())
- return;
- BUG_ON((unsigned long)p4d & (PAGE_SIZE-1));

Or maybe?

BUG_ON(!IS_ALIGNED((unsigned long)p4d, PAGE_SIZE));

Do you mean to keep BUG_ON() and change it to the above form?

I would prefer to just drop BUG_ON() as is done with the other
page tables.

Thanks,
Qi


- free_page((unsigned long)p4d);
+ if (pgtable_l5_enabled())
+ __p4d_free(mm, p4d);
}