Subject: [PATCH RFC 0/4] Demotion Profiling Improvements

From: Li Zhijian
Date: Wed Nov 01 2023 - 22:57:03 EST


With the deployment of high-capacity CXL Type 3 memory, HBM and Nvdimm,
the kernel now supports memory tiering. Building on this foundation
and aiming to further enhance memory efficiency, the kernel has
introduced demotion and promotion features.

To provide users with a more intuitive way to observe information
related to demotion, we have made several improvements to demotion
profiling, primarily in two aspects:

Patch 1 introduces a new interface: /sys/devices/system/node/node0/demotion_nodes
This interface is used to display the target nodes to which a node can demote.

Patch 2, Patch 3, and Patch 4 are improvements to demotion statistics.
Patch 2 changes the granularity of demotion statistics from global to per-node.
Patch 3 and Patch 4 further differentiate demotion statistics into demotion
source and demotion destination.

The names of the statistics are open to discussion; they could be named something
like pgdemote_from/to_* etc.
One issue with this patch set is that SUM(pgdemote_src_*) always equals SUM(pgdemote_dst_*)
in the global statistics (/proc/vmstat). Should we hide one of them?

Any feedback is welcome.

TO: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
TO: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
TO: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
CC: "Huang, Ying" <ying.huang@xxxxxxxxx>
CC: y-goto@xxxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
TO: linux-mm@xxxxxxxxx

Li Zhijian (4):
drivers/base/node: Add demotion_nodes sys infterface
mm/vmstat: Move pgdemote_* to per-node stats
mm/vmstat: rename pgdemote_* to pgdemote_dst_* and add pgdemote_src_*
drivers/base/node: add demote_src and demote_dst to numastat

drivers/base/node.c | 29 +++++++++++++++++++++++++++--
include/linux/memory-tiers.h | 6 ++++++
include/linux/mmzone.h | 7 +++++++
include/linux/vm_event_item.h | 3 ---
mm/memory-tiers.c | 8 ++++++++
mm/vmscan.c | 14 +++++++++++---
mm/vmstat.c | 9 ++++++---
7 files changed, 65 insertions(+), 11 deletions(-)

--
2.29.2