mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 01:23:00 -04:00
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 <[email protected]>
Cc: Gary Hade <[email protected]>
Cc: Badari Pulavarty <[email protected]>
Cc: Ingo Molnar <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Randy Dunlap <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: KOSAKI Motohiro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
d99be1a8ec
commit
dee5d0d518
3 changed files with 30 additions and 6 deletions
|
|
@ -312,6 +312,7 @@ static int get_nid_for_pfn(unsigned long pfn)
|
|||
/* register memory section under specified node if it spans that node */
|
||||
int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
|
||||
{
|
||||
int ret;
|
||||
unsigned long pfn, sect_start_pfn, sect_end_pfn;
|
||||
|
||||
if (!mem_blk)
|
||||
|
|
@ -328,9 +329,15 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
|
|||
continue;
|
||||
if (page_nid != nid)
|
||||
continue;
|
||||
return sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj,
|
||||
ret = sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj,
|
||||
&mem_blk->sysdev.kobj,
|
||||
kobject_name(&mem_blk->sysdev.kobj));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return sysfs_create_link_nowarn(&mem_blk->sysdev.kobj,
|
||||
&node_devices[nid].sysdev.kobj,
|
||||
kobject_name(&node_devices[nid].sysdev.kobj));
|
||||
}
|
||||
/* mem section does not span the specified node */
|
||||
return 0;
|
||||
|
|
@ -359,6 +366,8 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
|
|||
continue;
|
||||
sysfs_remove_link(&node_devices[nid].sysdev.kobj,
|
||||
kobject_name(&mem_blk->sysdev.kobj));
|
||||
sysfs_remove_link(&mem_blk->sysdev.kobj,
|
||||
kobject_name(&node_devices[nid].sysdev.kobj));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue