[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025021111-deepen-landing-4252@gregkh>
Date: Tue, 11 Feb 2025 07:51:31 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Tony Luck <tony.luck@...el.com>
Cc: Robert Moore <robert.moore@...el.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
acpica-devel@...ts.linux.dev, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
David Hildenbrand <david@...hat.com>,
Oscar Salvador <osalvador@...e.de>,
Danilo Krummrich <dakr@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] ACPI/MRRM: Add "node" symlink to
/sys/devices/system/memory/rangeX
On Mon, Feb 10, 2025 at 01:12:22PM -0800, Tony Luck wrote:
> Users will likely want to know which node owns each memory range
> and which CPUs are local to the range.
>
> Add a symlink to the node directory to provide both pieces of information.
>
> Signed-off-by: Tony Luck <tony.luck@...el.com>
> ---
> drivers/acpi/acpi_mrrm.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/drivers/acpi/acpi_mrrm.c b/drivers/acpi/acpi_mrrm.c
> index 51ed9064e025..28b484943bbd 100644
> --- a/drivers/acpi/acpi_mrrm.c
> +++ b/drivers/acpi/acpi_mrrm.c
> @@ -119,6 +119,31 @@ static struct attribute *memory_range_attrs[] = {
>
> ATTRIBUTE_GROUPS(memory_range);
>
> +static __init int add_node_link(struct mrrm_mem_range_entry *entry)
> +{
> + struct node *node = NULL;
> + int ret = 0;
> + int nid;
> +
> + for_each_online_node(nid) {
> + for (int z = 0; z < MAX_NR_ZONES; z++) {
> + struct zone *zone = NODE_DATA(nid)->node_zones + z;
> +
> + if (!populated_zone(zone))
> + continue;
> + if (zone_intersects(zone, PHYS_PFN(entry->base), PHYS_PFN(entry->length))) {
> + node = node_devices[zone->node];
> + goto found;
> + }
> + }
> + }
> +found:
> + if (node)
> + ret = sysfs_create_link(&entry->dev.kobj, &node->dev.kobj, "node");
What is going to remove this symlink if the memory goes away? Or do
these never get removed?
symlinks in sysfs created like this always worry me. What is going to
use it?
thanks,
greg k-h
Powered by blists - more mailing lists