Skip to contentSkip to conversation

mm/demotion: Expose memory tier details via sysfs

PATCH Applied Aneesh Kumar K.V 2 participants 4 messages Sep 22, 2022 – Sep 26, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 mm/demotion: Expose memory tier details via sysfs

This patch adds /sys/devices/virtual/memory_tiering/ where all memory tier related details can be found. All allocated memory tiers will be listed there as /sys/devices/virtual/memory_tiering/memory_tierN/

The nodes which are part of a specific memory tier can be listed via /sys/devices/virtual/memory_tiering/memory_tierN/nodes

A directory hierarchy looks like

:/sys/devices/virtual/memory_tiering$ tree memory_tier4/
memory_tier4/
├── nodes
├── subsystem -> ../../../../bus/memory_tiering
└── uevent
:/sys/devices/virtual/memory_tiering$ cat memory_tier4/nodes
0,2

---
Changes from v3:
* drop toptier_nodes from sysfs

 .../ABI/testing/sysfs-kernel-mm-memory-tiers  |  25 ++++
 mm/memory-tiers.c                             | 109 ++++++++++++++----
 2 files changed, 112 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-kernel-mm-memory-tiers
Documentation/ABI/testing/sysfs-kernel-mm-memory-tiers new file +25 -0
new file mode 100644
index 000000000000..45985e411f13
@@ -0,0 +1,25 @@
+What:		/sys/devices/virtual/memory_tiering/
+Date:		August 2022
+Contact:	Linux memory management mailing list <[email protected]>
+Description:	A collection of all the memory tiers allocated.
+
+		Individual memory tier details are contained in subdirectories
+		named by the abstract distance of the memory tier.
+
+		/sys/devices/virtual/memory_tiering/memory_tierN/
+
+
+What:		/sys/devices/virtual/memory_tiering/memory_tierN/
+		/sys/devices/virtual/memory_tiering/memory_tierN/nodes
+Date:		August 2022
+Contact:	Linux memory management mailing list <[email protected]>
+Description:	Directory with details of a specific memory tier
+
+		This is the directory containing information about a particular
+		memory tier, memtierN, where N is derived based on abstract distance.
+
+		A smaller value of N implies a higher (faster) memory tier in the
+		hierarchy.
+
+		nodes: NUMA nodes that are part of this memory tier.
+
mm/memory-tiers.c +87 -22

167 lines not on this page · raw message

Signature · 1 line
2.37.3
#1 lore raw
Quoted 6 lines · Aneesh Kumar K.V

This patch adds /sys/devices/virtual/memory_tiering/ where all memory tier related details can be found. All allocated memory tiers will be listed there as /sys/devices/virtual/memory_tiering/memory_tierN/

The nodes which are part of a specific memory tier can be listed via /sys/devices/virtual/memory_tiering/memory_tierN/nodes

It appears that XXXs is used for mask while XXXs_list is used for list? For example,

# cat /sys/devices/system/cpu/cpu2/topology/core_cpus
0,00100004
# cat /sys/devices/system/cpu/cpu2/topology/core_cpus_list
2,20

It's better to follow the this convention?

Quoted 11 lines

A directory hierarchy looks like

:/sys/devices/virtual/memory_tiering$ tree memory_tier4/
memory_tier4/
├── nodes
├── subsystem -> ../../../../bus/memory_tiering
└── uevent
:/sys/devices/virtual/memory_tiering$ cat memory_tier4/nodes
0,2

Best Regards,
Huang, Ying

[snip]

#2 lore raw
Quoted 12 lines · Ying
Quoted 6 lines · Aneesh Kumar K.V

This patch adds /sys/devices/virtual/memory_tiering/ where all memory tier related details can be found. All allocated memory tiers will be listed there as /sys/devices/virtual/memory_tiering/memory_tierN/

The nodes which are part of a specific memory tier can be listed via /sys/devices/virtual/memory_tiering/memory_tierN/nodes

It appears that XXXs is used for mask while XXXs_list is used for list? For example,

Quoted 7 lines
# cat /sys/devices/system/cpu/cpu2/topology/core_cpus
0,00100004
# cat /sys/devices/system/cpu/cpu2/topology/core_cpus_list
2,20

It's better to follow the this convention?

That is not followed in other parts of the kernel. I was loking at cpuset

$cat cpuset.cpus.effective
0-7

Quoted 16 lines
Quoted 11 lines

A directory hierarchy looks like

:/sys/devices/virtual/memory_tiering$ tree memory_tier4/
memory_tier4/
├── nodes
├── subsystem -> ../../../../bus/memory_tiering
└── uevent
:/sys/devices/virtual/memory_tiering$ cat memory_tier4/nodes
0,2

Best Regards,
Huang, Ying

[snip]

#3 lore raw
Quoted 18 lines · Aneesh Kumar K V
Quoted 17 lines · Ying
Quoted 6 lines · Aneesh Kumar K.V

This patch adds /sys/devices/virtual/memory_tiering/ where all memory tier related details can be found. All allocated memory tiers will be listed there as /sys/devices/virtual/memory_tiering/memory_tierN/

The nodes which are part of a specific memory tier can be listed via /sys/devices/virtual/memory_tiering/memory_tierN/nodes

It appears that XXXs is used for mask while XXXs_list is used for list? For example,

# cat /sys/devices/system/cpu/cpu2/topology/core_cpus
0,00100004
# cat /sys/devices/system/cpu/cpu2/topology/core_cpus_list
2,20
Quoted 7 lines
Quoted 2 lines

It's better to follow the this convention?

That is not followed in other parts of the kernel. I was loking at cpuset

$cat cpuset.cpus.effective
0-7

Per my understanding, cpuset isn't sysfs, but cgroupfs?

I did some research in my system,

$ grep . $(find /sys/devices | grep 'list$')

and

$ grep . $(find /sys/devices | grep 'cpus$')

I found that the cpus/cpus_list convention is used in

- pci

/sys/devices/pci0000:64/0000:64:0d.2/local_cpulist:0-35 /sys/devices/pci0000:64/0000:64:0c.2/local_cpus:f,ffffffff

- system

/sys/devices/system/cpu/cpu7/topology/core_cpus_list:7,25 /sys/devices/system/cpu/cpu7/topology/core_cpus:0,02000080

- block

/sys/devices/virtual/block/loop1/mq/0/cpu_list:0, 1, 2, ...

- net

/sys/devices/virtual/net/lo/queues/rx-0/rps_cpus:0,00000000

And I haven't found any exception in sysfs of my system. Can you find some?

Best Regards,
Huang, Ying

Quoted 16 lines
Quoted 16 lines
Quoted 11 lines

A directory hierarchy looks like

:/sys/devices/virtual/memory_tiering$ tree memory_tier4/
memory_tier4/
├── nodes
├── subsystem -> ../../../../bus/memory_tiering
└── uevent
:/sys/devices/virtual/memory_tiering$ cat memory_tier4/nodes
0,2

Best Regards,
Huang, Ying

[snip]