LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Andi Kleen <ak@suse.de>, Rohit Seth <rohitseth@google.com>,
	linux-kernel@vger.kernel.org
Subject: [patch -mm 7/7] x86_64: export physnode mapping to userspace
Date: Wed, 31 Jan 2007 07:18:33 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701302226380.23658@chino.kir.corp.google.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0701302226040.23658@chino.kir.corp.google.com>

Exports the physical NUMA node to fake NUMA node mapping to user-space via
sysfs.  The information is now accessible via the 'physnode' file.

Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Rohit Seth <rohitseth@google.com>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 drivers/base/node.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 001e6f6..548d365 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -136,6 +136,13 @@ static ssize_t node_read_distance(struct sys_device * dev, char * buf)
 }
 static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL);
 
+#ifdef CONFIG_NUMA_EMU
+static ssize_t node_read_physnode(struct sys_device *dev, char *buf)
+{
+	return sprintf(buf, "%d\n", get_phys_node(dev->id));
+}
+static SYSDEV_ATTR(physnode, S_IRUGO, node_read_physnode, NULL);
+#endif
 
 /*
  * register_node - Setup a driverfs device for a node.
@@ -156,6 +163,9 @@ int register_node(struct node *node, int num, struct node *parent)
 		sysdev_create_file(&node->sysdev, &attr_meminfo);
 		sysdev_create_file(&node->sysdev, &attr_numastat);
 		sysdev_create_file(&node->sysdev, &attr_distance);
+#ifdef CONFIG_NUMA_EMU
+		sysdev_create_file(&node->sysdev, &attr_physnode);
+#endif
 	}
 	return error;
 }
@@ -173,6 +183,9 @@ void unregister_node(struct node *node)
 	sysdev_remove_file(&node->sysdev, &attr_meminfo);
 	sysdev_remove_file(&node->sysdev, &attr_numastat);
 	sysdev_remove_file(&node->sysdev, &attr_distance);
+#ifdef CONFIG_NUMA_EMU
+	sysdev_remove_file(&node->sysdev, &attr_physnode);
+#endif
 
 	sysdev_unregister(&node->sysdev);
 }

      reply	other threads:[~2007-01-31 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-31 15:17 [patch -mm 1/7] x86_64: configurable fake numa node sizes David Rientjes
2007-01-31 15:17 ` [patch -mm 2/7] x86_64: split remaining fake nodes equally David Rientjes
2007-01-31 15:18   ` [patch -mm 3/7] x86_64: fixed-size remaining fake nodes David Rientjes
2007-01-31 15:18     ` [patch -mm 4/7] x86_64: fake numa for cpusets document David Rientjes
2007-01-31 15:18       ` [patch -mm 5/7] x86_64: map fake nodes to real nodes David Rientjes
2007-01-31 15:18         ` [patch -mm 6/7] x86_64: disable alien cache for fake numa David Rientjes
2007-01-31 15:18           ` David Rientjes [this message]

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=Pine.LNX.4.64.0701302226380.23658@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rohitseth@google.com \
    --subject='Re: [patch -mm 7/7] x86_64: export physnode mapping to userspace' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).