Re: [PATCH 1/2] mm: pgtable: add missing flag and statistics for kernel PTE page

From: Matthew Wilcox
Date: Sun Feb 04 2024 - 13:51:24 EST


On Thu, Feb 01, 2024 at 04:05:40PM +0800, Qi Zheng wrote:
> For kernel PTE page, we do not need to allocate and initialize its split
> ptlock, but as a page table page, it's still necessary to add PG_table
> flag and NR_PAGETABLE statistics for it.

No, this is wrong.

We do not account _kernel_ page tables to the _user_. Just because
the kernel, say, called vmalloc() doesn't mean we should charge the
task for it. Moreover, one task may call vmalloc() and a different task
would then call vfree().

This is a can of worms you don't want to open. Why did you want to do
this?