[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHbLzkpNBRdhBewviYWke+dgERjKi_nhEdTU5V75Sr92yp2K3w@mail.gmail.com>
Date: Fri, 22 Apr 2022 10:37:00 -0700
From: Yang Shi <shy828301@...il.com>
To: linux-mm@...ck.org, 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, jvgediya@...ux.ibm.com,
ying.huang@...el.com
Subject: Re: [PATCH 6/6] mm/migrate: export whether or not node is toptier in sysf
On Sat, Apr 16, 2022 at 8:49 PM Davidlohr Bueso <dave@...olabs.net> wrote:
>
>
>
> 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));
It is not guaranteed. Some hardware configurations have cpuless DRAM
nodes, but they should be treated as top tier nodes IMHO. Please see
https://lore.kernel.org/linux-mm/20220413092206.73974-1-jvgediya@linux.ibm.com/
> +
> + 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