[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220417034932.jborenmvfbqrfhlj@offworld>
Date: Sat, 16 Apr 2022 20:49:32 -0700
From: Davidlohr Bueso <dave@...olabs.net>
To: linux-mm@...ck.org
Cc: mhocko@...nel.org, akpm@...ux-foundation.org, rientjes@...gle.com,
yosryahmed@...gle.com, hannes@...xchg.org, shakeelb@...gle.com,
dave.hansen@...ux.intel.com, tim.c.chen@...ux.intel.com,
roman.gushchin@...ux.dev, gthelen@...gle.com,
a.manzanares@...sung.com, heekwon.p@...sung.com,
gim.jongmin@...sung.com, linux-kernel@...r.kernel.org
Subject: [PATCH 6/6] mm/migrate: export whether or not node is toptier in sysf
This allows userspace to know if the node is considered fast
memory (with CPUs attached to it). While this can be already
derived without a new file, this helps further encapsulate the
concept.
Signed-off-by: Davidlohr Bueso <dave@...olabs.net>
---
Resending, just noticed this oatch was never posted.
Documentation/ABI/stable/sysfs-devices-node | 6 ++++++
drivers/base/node.c | 13 +++++++++++++
2 files changed, 19 insertions(+)
diff --git a/Documentation/ABI/stable/sysfs-devices-node b/Documentation/ABI/stable/sysfs-devices-node
index f620c6ae013c..1c21c3985535 100644
--- a/Documentation/ABI/stable/sysfs-devices-node
+++ b/Documentation/ABI/stable/sysfs-devices-node
@@ -198,3 +198,9 @@ Date: April 2022
Contact: Davidlohr Bueso <dave@...olabs.net>
Description:
Shows nodes within the next tier of slower memory below this node.
+
+What: /sys/devices/system/node/nodeX/memory_toptier
+Date: April 2022
+Contact: Davidlohr Bueso <dave@...olabs.net>
+Description:
+ Node is attached to fast memory or not.
diff --git a/drivers/base/node.c b/drivers/base/node.c
index ab4bae777535..b9de5b0360f2 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -598,12 +598,25 @@ static ssize_t node_read_demotion_path(struct device *dev,
}
static DEVICE_ATTR(demotion_path, 0444, node_read_demotion_path, NULL);
+static ssize_t node_read_memory_toptier(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int nid = dev->id;
+ int len = 0;
+
+ len += sysfs_emit_at(buf, len, "%d\n", !!node_is_toptier(nid));
+
+ return len;
+}
+static DEVICE_ATTR(memory_toptier, 0444, node_read_memory_toptier, NULL);
+
static struct attribute *node_dev_attrs[] = {
&dev_attr_meminfo.attr,
&dev_attr_numastat.attr,
&dev_attr_distance.attr,
&dev_attr_vmstat.attr,
&dev_attr_demotion_path.attr,
+ &dev_attr_memory_toptier.attr,
NULL
};
--
2.26.2
Powered by blists - more mailing lists