[RFC PATCH 0/3] Fix and refactor do_{huge_pmd_}numa_page()

From: Zi Yan
Date: Thu Jul 11 2024 - 22:45:13 EST


From: Zi Yan <ziy@xxxxxxxxxx>

First patch adds the missing sysctl_numa_balancing_mode check. Second patch
introduces folio_has_cpupid() to replace open coded folio last_cpupid check.
Third patch consolidates code in do_numa_page() and do_huge_pmd_numa_page()
by moving more common code into numa_migrate_prep() (renamed to
numa_migrate_check() in the patch).

The RFC is mainly for third patch. It changes the original code behavior:
1. do_huge_pmd_numa_page() did not check shared folios to set TNF_SHARED.
2. do_huge_pmd_numa_page() did not check and skip zone device folios.



Zi Yan (3):
memory tiering: read last_cpupid correctly in do_huge_pmd_numa_page()
memory tiering: introduce folio_has_cpupid() check
mm/migrate: move common code to numa_migrate_check (was
numa_migrate_prep)

include/linux/memory-tiers.h | 8 ++++
kernel/sched/fair.c | 3 +-
mm/huge_memory.c | 31 +++++---------
mm/internal.h | 5 ++-
mm/memory-tiers.c | 17 ++++++++
mm/memory.c | 82 +++++++++++++++++-------------------
mm/mprotect.c | 3 +-
7 files changed, 80 insertions(+), 69 deletions(-)

--
2.43.0