Re: [PATCH -next 1/7] mm_types: add _last_cpupid into folio

From: Kefeng Wang
Date: Tue Oct 10 2023 - 23:02:22 EST




On 2023/10/10 20:33, Matthew Wilcox wrote:
On Tue, Oct 10, 2023 at 02:45:38PM +0800, Kefeng Wang wrote:
At present, only arc/sparc/m68k define WANT_PAGE_VIRTUAL, both of
them don't support numa balancing, and the page struct is aligned
to _struct_page_alignment, it is safe to move _last_cpupid before
'virtual' in page, meanwhile, add it into folio, which make us to
use folio->_last_cpupid directly.

What do you mean by "safe"? I think you mean "Does not increase the
size of struct page", but if that is what you mean, why not just say so?
If there's something else you mean, please explain.

Don't increase size of struct page and don't impact the real order of
struct page as the above three archs without numa balancing support.


In any event, I'd like to see some reasoning that _last_cpupid is actually
information which is logically maintained on a per-allocation basis,
not a per-page basis (I think this is true, but I honestly don't know)

The _last_cpupid is updated in should_numa_migrate_memory() from numa
fault(do_numa_page, and do_huge_pmd_numa_page), it is per-page(normal
page and PMD-mapped page). Maybe I misunderstand your mean, please
correct me.


And looking at all this, I think it makes sense to move _last_cpupid
before the kmsan garbage, then add both 'virtual' and '_last_cpupid'
to folio.

sure, I will add both of them into folio and don't re-order 'virtual' and '_last_cpupid'.