aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/node.c
diff options
context:
space:
mode:
authorAlex Chiang <achiang@hp.com>2009-12-14 20:59:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:17 -0500
commitdee5d0d518defd0337a41f1a504428c9acc87be5 (patch)
treedeb540b5ccc58f0e83114509e17dacb281fc12e5 /drivers/base/node.c
parentd99be1a8ecf377c2c9b3372d36411ad6547bbd4c (diff)
mm: add numa node symlink for memory section in sysfs
Commit c04fc586c (mm: show node to memory section relationship with symlinks in sysfs) created symlinks from nodes to memory sections, e.g. /sys/devices/system/node/node1/memory135 -> ../../memory/memory135 If you're examining the memory section though and are wondering what node it might belong to, you can find it by grovelling around in sysfs, but it's a little cumbersome. Add a reverse symlink for each memory section that points back to the node to which it belongs. Signed-off-by: Alex Chiang <achiang@hp.com> Cc: Gary Hade <garyhade@us.ibm.com> Cc: Badari Pulavarty <pbadari@us.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Acked-by: David Rientjes <rientjes@google.com> Cc: Greg KH <greg@kroah.com> Cc: Randy Dunlap <randy.dunlap@oracle.com> Cc: David Rientjes <rientjes@google.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base/node.c')
-rw-r--r--drivers/base/node.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 54e5d8eaf70e..44eed11bbdf3 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -312,6 +312,7 @@ static int get_nid_for_pfn(unsigned long pfn)
312/* register memory section under specified node if it spans that node */ 312/* register memory section under specified node if it spans that node */
313int register_mem_sect_under_node(struct memory_block *mem_blk, int nid) 313int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
314{ 314{
315 int ret;
315 unsigned long pfn, sect_start_pfn, sect_end_pfn; 316 unsigned long pfn, sect_start_pfn, sect_end_pfn;
316 317
317 if (!mem_blk) 318 if (!mem_blk)
@@ -328,9 +329,15 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
328 continue; 329 continue;
329 if (page_nid != nid) 330 if (page_nid != nid)
330 continue; 331 continue;
331 return sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj, 332 ret = sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj,
332 &mem_blk->sysdev.kobj, 333 &mem_blk->sysdev.kobj,
333 kobject_name(&mem_blk->sysdev.kobj)); 334 kobject_name(&mem_blk->sysdev.kobj));
335 if (ret)
336 return ret;
337
338 return sysfs_create_link_nowarn(&mem_blk->sysdev.kobj,
339 &node_devices[nid].sysdev.kobj,
340 kobject_name(&node_devices[nid].sysdev.kobj));
334 } 341 }
335 /* mem section does not span the specified node */ 342 /* mem section does not span the specified node */
336 return 0; 343 return 0;
@@ -359,6 +366,8 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
359 continue; 366 continue;
360 sysfs_remove_link(&node_devices[nid].sysdev.kobj, 367 sysfs_remove_link(&node_devices[nid].sysdev.kobj,
361 kobject_name(&mem_blk->sysdev.kobj)); 368 kobject_name(&mem_blk->sysdev.kobj));
369 sysfs_remove_link(&mem_blk->sysdev.kobj,
370 kobject_name(&node_devices[nid].sysdev.kobj));
362 } 371 }
363 return 0; 372 return 0;
364} 373}