node0 and node1 is DRAM node, node3 is a PMEM node. $ cat /sys/devices/system/node/node1/numastat numa_hit 646590 numa_miss 3963 numa_foreign 30651 interleave_hit 416 local_node 645252 other_node 5301 demote_src 200478 demote_dst 0 Of cousre, the userspace numastat will be extened to support these 2 new fields in the future like: $ numastat node0 node1 node3 numa_hit 741793 702460 364154 numa_miss 1759 8104 28893 numa_foreign 8105 30651 0 interleave_hit 653 416 0 local_node 741762 701115 0 other_node 1790 9449 393047 demote_src 163612 203828 0 demote_dst 0 0 367440 Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx> --- drivers/base/node.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index 27e8502548a7..d3fc70599b6a 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -496,20 +496,32 @@ static DEVICE_ATTR(meminfo, 0444, node_read_meminfo, NULL); static ssize_t node_read_numastat(struct device *dev, struct device_attribute *attr, char *buf) { + struct pglist_data *pgdat = NODE_DATA(dev->id); + unsigned long demote_src, demote_dst; + fold_vm_numa_events(); + demote_src = node_page_state_pages(pgdat, PGDEMOTE_SRC_KSWAPD) + + node_page_state_pages(pgdat, PGDEMOTE_SRC_DIRECT) + + node_page_state_pages(pgdat, PGDEMOTE_SRC_KHUGEPAGED); + demote_dst = node_page_state_pages(pgdat, PGDEMOTE_DST_KSWAPD) + + node_page_state_pages(pgdat, PGDEMOTE_DST_DIRECT) + + node_page_state_pages(pgdat, PGDEMOTE_DST_KHUGEPAGED); return sysfs_emit(buf, "numa_hit %lu\n" "numa_miss %lu\n" "numa_foreign %lu\n" "interleave_hit %lu\n" "local_node %lu\n" - "other_node %lu\n", + "other_node %lu\n" + "demote_src %lu\n" + "demote_dst %lu\n", sum_zone_numa_event_state(dev->id, NUMA_HIT), sum_zone_numa_event_state(dev->id, NUMA_MISS), sum_zone_numa_event_state(dev->id, NUMA_FOREIGN), sum_zone_numa_event_state(dev->id, NUMA_INTERLEAVE_HIT), sum_zone_numa_event_state(dev->id, NUMA_LOCAL), - sum_zone_numa_event_state(dev->id, NUMA_OTHER)); + sum_zone_numa_event_state(dev->id, NUMA_OTHER), + demote_src, demote_dst); } static DEVICE_ATTR(numastat, 0444, node_read_numastat, NULL); -- 2.29.2