linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: linux-mm@kvack.org
Cc: mhocko@kernel.org, akpm@linux-foundation.org,
	rientjes@google.com, yosryahmed@google.com, hannes@cmpxchg.org,
	shakeelb@google.com, dave.hansen@linux.intel.com,
	tim.c.chen@linux.intel.com, roman.gushchin@linux.dev,
	gthelen@google.com, a.manzanares@samsung.com,
	heekwon.p@samsung.com, gim.jongmin@samsung.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] mm/migrate: export whether or not node is toptier in sysf
Date: Sat, 16 Apr 2022 20:49:32 -0700	[thread overview]
Message-ID: <20220417034932.jborenmvfbqrfhlj@offworld> (raw)
In-Reply-To: <20220416053902.68517-1-dave@stgolabs.net>



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@stgolabs.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@stgolabs.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@stgolabs.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


  parent reply	other threads:[~2022-04-17  3:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-16  5:38 [PATCH RFC lsfmm 0/6] mm: proactive reclaim and memory tiering topics Davidlohr Bueso
2022-04-16  5:38 ` [PATCH 1/6] drivers/base/node: cleanup register_node() Davidlohr Bueso
2022-04-25 22:30   ` Adam Manzanares
2022-05-03 18:17   ` David Hildenbrand
2022-05-04  4:33   ` David Rientjes
2022-04-16  5:38 ` [PATCH 2/6] mm/vmscan: use node_is_toptier helper in node_reclaim Davidlohr Bueso
2022-04-25 22:32   ` Adam Manzanares
2022-05-04  4:33   ` David Rientjes
2022-05-04  7:26   ` Jagdish Gediya
2022-05-31 11:50   ` Aneesh Kumar K.V
2022-06-01  6:12     ` Ying Huang
2022-04-16  5:38 ` [PATCH 3/6] mm: make __node_reclaim() more flexible Davidlohr Bueso
2022-04-16  5:39 ` [PATCH 4/6] mm: introduce per-node proactive reclaim interface Davidlohr Bueso
2022-04-19  0:00   ` Tim Chen
2022-04-16  5:39 ` [PATCH 5/6] mm/migration: export demotion_path of a node via sysfs Davidlohr Bueso
2022-04-22 17:31   ` Yang Shi
2022-04-22 17:33     ` Yang Shi
2022-04-22 17:50       ` Davidlohr Bueso
2022-04-17  3:49 ` Davidlohr Bueso [this message]
2022-04-18 15:34   ` [PATCH 6/6] mm/migrate: export whether or not node is toptier in sysf Dave Hansen
2022-04-18 16:45     ` Davidlohr Bueso
2022-04-18 16:50       ` Dave Hansen
2022-04-22 17:37   ` Yang Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220417034932.jborenmvfbqrfhlj@offworld \
    --to=dave@stgolabs.net \
    --cc=a.manzanares@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=gim.jongmin@samsung.com \
    --cc=gthelen@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=heekwon.p@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox