Skip to contentSkip to conversation

mm: modest useability enhancements for node sysfs attrs

PATCH Superseded Alex Chiang 4 participants 21 messages Oct 22, 2009 – Nov 10, 2009

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover mm: modest useability enhancements for node sysfs attrs

This is v2 of the series.

The last patch in this series is dependent upon the documentation patch series that I just sent out a few moments ago:

	http://thread.gmane.org/gmane.linux.kernel/905018

Thanks,
/ac

v1 -> v2: http://thread.gmane.org/gmane.linux.kernel.mm/40084/
Address David Rientjes's comments
- check return value of sysfs_create_link in register_cpu_under_node
- do /not/ convert [un]register_cpu_under_node to return void, since sparse starts whinging if you ignore sysfs_create_link()'s return value and working around sparse makes the code ugly
- adjust documentation

Added S390 maintainers to cc: for patch [1/5] as per Kame-san's suggestion. S390 may map a memory section to more than one node, causing this series to break.

---

Alex Chiang (5):
mm: add numa node symlink for memory section in sysfs
mm: refactor register_cpu_under_node()
mm: refactor unregister_cpu_under_node()
mm: add numa node symlink for cpu devices in sysfs
Documentation: ABI: /sys/devices/system/cpu/cpu#/node

 Documentation/ABI/testing/sysfs-devices-memory     |   14 ++++-
 Documentation/ABI/testing/sysfs-devices-system-cpu |   15 +++++
 Documentation/memory-hotplug.txt                   |   11 ++--
 drivers/base/node.c                                |   58 ++++++++++++++------
 4 files changed, 77 insertions(+), 21 deletions(-)
#1 lore raw

PATCH v2 1/5 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.

Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Gary Hade <[email protected]>
Cc Badari Pulavarty <[email protected]>
Cc Ingo Molnar <[email protected]>

---

 Documentation/ABI/testing/sysfs-devices-memory |   14 +++++++++++++-
 Documentation/memory-hotplug.txt               |   11 +++++++----
 drivers/base/node.c                            |   11 ++++++++++-
 3 files changed, 30 insertions(+), 6 deletions(-)
Documentation/ABI/testing/sysfs-devices-memory +13 -1
index 9fe91c0..bf1627b 100644
@@ -60,6 +60,19 @@ Description:
 Users:		hotplug memory remove tools
 		https://w3.opensource.ibm.com/projects/powerpc-utils/
 
+
+What:		/sys/devices/system/memoryX/nodeY
+Date:		October 2009
+Contact:	Linux Memory Management list <[email protected]>
+Description:
+		When CONFIG_NUMA is enabled, a symbolic link that
+		points to the corresponding NUMA node directory.
+
+		For example, the following symbolic link is created for
+		memory section 9 on node0:
+		/sys/devices/system/memory/memory9/node0 -> ../../node/node0
+
+
 What:		/sys/devices/system/node/nodeX/memoryY
 Date:		September 2008
 Contact:	Gary Hade <[email protected]>
@@ -70,4 +83,3 @@ Description:
 		memory section directory.  For example, the following symbolic
 		link is created for memory section 9 on node0.
 		/sys/devices/system/node/node0/memory9 -> ../../memory/memory9
-
Documentation/memory-hotplug.txt +7 -4
index bbc8a6a..57e7e9c 100644
@@ -160,12 +160,15 @@ Under each section, you can see 4 files.
 NOTE:
   These directories/files appear after physical memory hotplug phase.
 
-If CONFIG_NUMA is enabled the
-/sys/devices/system/memory/memoryXXX memory section
-directories can also be accessed via symbolic links located in
-the /sys/devices/system/node/node* directories.  For example:
+If CONFIG_NUMA is enabled the memoryXXX/ directories can also be accessed
+via symbolic links located in the /sys/devices/system/node/node* directories.
+
+For example:
 /sys/devices/system/node/node0/memory9 -> ../../memory/memory9
 
+A backlink will also be created:
+/sys/devices/system/memory/memory9/node0 -> ../../node/node0
+
 --------------------------------
 4. Physical memory hot-add phase
 --------------------------------
drivers/base/node.c +10 -1
index 1fe5536..3108b21 100644
@@ -268,6 +268,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)
@@ -284,9 +285,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;
@@ -315,6 +322,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;
 }

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v2 1/5
#2 lore raw

Re: [PATCH v2 1/5] mm: add numa node symlink for memory section in sysfs

Quoted 12 lines · Alex Chiang

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.

Quoted 6 lines
Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Gary Hade <[email protected]>
Cc Badari Pulavarty <[email protected]>
Cc Ingo Molnar <[email protected]>

Very helpful backlinks to memory section nodes even though I have lots of memory directories on some of my test machines :)

#3 lore raw

Re: [PATCH v2 1/5] mm: add numa node symlink for memory section in sysfs

Thank you for ACKing, David.

S390 guys, I cc'ed you on this patch because I heard a rumour that your memory sections may belong to more than one NUMA node? Is that true? If so, how would you like me to handle that situation?

Any comments on this patch series would be appreciated.

Thanks.
/ac

* David Rientjes <[email protected]>:

Quoted 25 lines · Alex Chiang
Quoted 13 lines

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.

Quoted 6 lines
Cc Martin Schwidefsky <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Gary Hade <[email protected]>
Cc Badari Pulavarty <[email protected]>
Cc Ingo Molnar <[email protected]>

Very helpful backlinks to memory section nodes even though I have lots of memory directories on some of my test machines :)

#4 lore raw

Re: [PATCH v2 1/5] mm: add numa node symlink for memory section in sysfs

Quoted 7 lines · Alex Chiang

Thank you for ACKing, David.

S390 guys, I cc'ed you on this patch because I heard a rumour that your memory sections may belong to more than one NUMA node? Is that true? If so, how would you like me to handle that situation?

You're referring to how unregister_mem_sect_under_nodes() should be handled, right? register_mem_sect_under_node() already looks supported by your patch.

Since the unregister function includes a plural "nodes," I assume that it's possible for hotplug to register a memory section to more than one node. That's probably lacking on x86 currently, however, because we lack node hotplug.

I'd suggest a similiar iteration through pfn's that the register function does checking for multiple nodes and then removing the link from all applicable node_devices kobj when unregistering.

Maybe one of the s390 maintainers will test that?

#5 lore raw

Re: [PATCH v2 1/5] mm: add numa node symlink for memory section in sysfs

Quoted 19 lines · David Rientjes
Quoted 7 lines · Alex Chiang

Thank you for ACKing, David.

S390 guys, I cc'ed you on this patch because I heard a rumour that your memory sections may belong to more than one NUMA node? Is that true? If so, how would you like me to handle that situation?

You're referring to how unregister_mem_sect_under_nodes() should be handled, right? register_mem_sect_under_node() already looks supported by your patch.

Since the unregister function includes a plural "nodes," I assume that it's possible for hotplug to register a memory section to more than one node. That's probably lacking on x86 currently, however, because we lack node hotplug.

Quoted 5 lines

I'd suggest a similiar iteration through pfn's that the register function does checking for multiple nodes and then removing the link from all applicable node_devices kobj when unregistering.

Maybe one of the s390 maintainers will test that?

The short answer is: s390 doesn't support NUMA, because the hardware doesn't tell us to which node (book in s390 terms) a memory range belongs to.

Memory layout for a logical partition is striped: first x mbyte belong to node 0, next x mbyte belong to node 1, etc...

Also, since there is always a hypervisor running below Linux I don't think it would make too much sense if we would know to which node a piece of memory belongs to: if the hypervisor decides to schedule a virtual cpu of a logical partition to a different node then what?

#6 lore raw

Re: [PATCH v2 1/5] mm: add numa node symlink for memory section in sysfs

Quoted 11 lines · Heiko Carstens

The short answer is: s390 doesn't support NUMA, because the hardware doesn't tell us to which node (book in s390 terms) a memory range belongs to.

Memory layout for a logical partition is striped: first x mbyte belong to node 0, next x mbyte belong to node 1, etc...

Also, since there is always a hypervisor running below Linux I don't think it would make too much sense if we would know to which node a piece of memory belongs to: if the hypervisor decides to schedule a virtual cpu of a logical partition to a different node then what?

Ok, so the patchset is a no-op for s390 since it only utilizes the !CONFIG_NUMA code.

Alex, I think the safest thing to do in unregister_mem_sect_under_nodes() is to iterate though the section pfns and remove links to the node_device kobjs for all the distinct pfn_to_nid()'s that it encounters.

#7 lore raw

Re: [PATCH v2 1/5] mm: add numa node symlink for memory section in sysfs

* David Rientjes <[email protected]>:

Quoted 8 lines · Heiko Carstens
Quoted 7 lines

The short answer is: s390 doesn't support NUMA, because the hardware doesn't tell us to which node (book in s390 terms) a memory range belongs to.

Memory layout for a logical partition is striped: first x mbyte belong to node 0, next x mbyte belong to node 1, etc...

Quoted 8 lines
Quoted 5 lines

Also, since there is always a hypervisor running below Linux I don't think it would make too much sense if we would know to which node a piece of memory belongs to: if the hypervisor decides to schedule a virtual cpu of a logical partition to a different node then what?

Ok, so the patchset is a no-op for s390 since it only utilizes the !CONFIG_NUMA code.

Sounds good.

Quoted 3 lines

Alex, I think the safest thing to do in unregister_mem_sect_under_nodes() is to iterate though the section pfns and remove links to the node_device kobjs for all the distinct pfn_to_nid()'s that it encounters.

Ok, I will respin.

Thanks!
/ac

#8 lore raw

Re: [PATCH v2 1/5] mm: add numa node symlink for memory section in sysfs

In reply to David Rientjes

* David Rientjes <[email protected]>:

Quoted 4 lines

Alex, I think the safest thing to do in unregister_mem_sect_under_nodes() is to iterate though the section pfns and remove links to the node_device kobjs for all the distinct pfn_to_nid()'s that it encounters.

Am I not understanding the code? It looks like we do this already...

/* unregister memory section under all nodes that it spans */ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)

{
	nodemask_t unlinked_nodes;
	unsigned long pfn, sect_start_pfn, sect_end_pfn;

	if (!mem_blk)
		return -EFAULT;
	nodes_clear(unlinked_nodes);
	sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index);
	sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
		int nid;

		nid = get_nid_for_pfn(pfn);
		if (nid < 0)
			continue;
		if (!node_online(nid))
			continue;
		if (node_test_and_set(nid, unlinked_nodes))
			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;
}

Thanks,
/ac

#9 lore raw

PATCH 1/1 mm: slab allocate memory section nodemask for large systems

Quoted 23 lines · Alex Chiang

Am I not understanding the code? It looks like we do this already...

/* unregister memory section under all nodes that it spans */ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)

{
	nodemask_t unlinked_nodes;
	unsigned long pfn, sect_start_pfn, sect_end_pfn;

	if (!mem_blk)
		return -EFAULT;
	nodes_clear(unlinked_nodes);
	sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index);
	sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
		int nid;

		nid = get_nid_for_pfn(pfn);
		if (nid < 0)
			continue;
		if (!node_online(nid))
			continue;
		if (node_test_and_set(nid, unlinked_nodes))
Quoted 9 lines
			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;
}

That shound be sufficient with the exception that allocating nodemask_t on the stack is usually dangerous because it can be extremely large; we typically use NODEMASK_ALLOC() for such code. It's had some changes in -mm, but since this patchset will likely be going through that tree anyway we can fix it now with the patch below.

Otherwise, it looks like the iteration is already there and will remove links for memory sections bound to multiple nodes if they exist through hotplug.

mm: slab allocate memory section nodemask for large systems

Nodemasks should not be allocated on the stack for large systems (when it is larger than 256 bytes) since there is a threat of overflow.

This patch causes the unregister_mem_sect_under_nodes() nodemask to be allocated on the stack for smaller systems and be allocated by slab for larger systems.

GFP_KERNEL is used since remove_memory_block() can block.

Cc Gary Hade <[email protected]>
Cc Badari Pulavarty <[email protected]>

---
Depends on NODEMASK_ALLOC() changes currently present only in -mm.

 drivers/base/node.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/base/node.c +7 -4
@@ -363,12 +363,14 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
 /* unregister memory section under all nodes that it spans */
 int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
 {
-	nodemask_t unlinked_nodes;
+	NODEMASK_ALLOC(nodemask_t, unlinked_nodes, GFP_KERNEL);
 	unsigned long pfn, sect_start_pfn, sect_end_pfn;
 
-	if (!mem_blk)
+	if (!mem_blk) {
+		NODEMASK_FREE(unlinked_nodes);
 		return -EFAULT;
-	nodes_clear(unlinked_nodes);
+	}
+	nodes_clear(*unlinked_nodes);
 	sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index);
 	sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
 	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
@@ -379,13 +381,14 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
 			continue;
 		if (!node_online(nid))
 			continue;
-		if (node_test_and_set(nid, unlinked_nodes))
+		if (node_test_and_set(nid, *unlinked_nodes))
 			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));
 	}
+	NODEMASK_FREE(unlinked_nodes);
 	return 0;
 }
 
#10 lore raw

Re: [patch -mm] mm: slab allocate memory section nodemask for large systems

Hi Andrew,

* David Rientjes <[email protected]>:

Quoted 41 lines · Alex Chiang
Quoted 24 lines

Am I not understanding the code? It looks like we do this already...

/* unregister memory section under all nodes that it spans */ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)

{
	nodemask_t unlinked_nodes;
	unsigned long pfn, sect_start_pfn, sect_end_pfn;

	if (!mem_blk)
		return -EFAULT;
	nodes_clear(unlinked_nodes);
	sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index);
	sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
		int nid;

		nid = get_nid_for_pfn(pfn);
		if (nid < 0)
			continue;
		if (!node_online(nid))
			continue;
		if (node_test_and_set(nid, unlinked_nodes))
Quoted 9 lines
			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;
}

That shound be sufficient with the exception that allocating nodemask_t on the stack is usually dangerous because it can be extremely large; we typically use NODEMASK_ALLOC() for such code. It's had some changes in -mm, but since this patchset will likely be going through that tree anyway we can fix it now with the patch below.

Quoted 3 lines

Otherwise, it looks like the iteration is already there and will remove links for memory sections bound to multiple nodes if they exist through hotplug.

Any comments on this patch series?

Turns out that Kame-san's fear about a memory section spanning several nodes on certain architectures (S390) isn't really applicable and even if it were, we have code to handle situation anyway.

Kame-san was generally supportive of these convenience symlinks although he did not give a formal ACK.

David has given an ACK on the two patches that do real work, as well as supplied the below patch.

I can respin this series once more, including David's Acked-by:
and adding his patch if that makes life easier for you.

Thanks,
/ac

Quoted 58 lines

mm: slab allocate memory section nodemask for large systems

Nodemasks should not be allocated on the stack for large systems (when it is larger than 256 bytes) since there is a threat of overflow.

This patch causes the unregister_mem_sect_under_nodes() nodemask to be allocated on the stack for smaller systems and be allocated by slab for larger systems.

GFP_KERNEL is used since remove_memory_block() can block.

Cc Gary Hade <[email protected]>
Cc Badari Pulavarty <[email protected]>

---
Depends on NODEMASK_ALLOC() changes currently present only in -mm.

 drivers/base/node.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/base/node.c +7 -4
@@ -363,12 +363,14 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
 /* unregister memory section under all nodes that it spans */
 int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
 {
-	nodemask_t unlinked_nodes;
+	NODEMASK_ALLOC(nodemask_t, unlinked_nodes, GFP_KERNEL);
 	unsigned long pfn, sect_start_pfn, sect_end_pfn;
 
-	if (!mem_blk)
+	if (!mem_blk) {
+		NODEMASK_FREE(unlinked_nodes);
 		return -EFAULT;
-	nodes_clear(unlinked_nodes);
+	}
+	nodes_clear(*unlinked_nodes);
 	sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index);
 	sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
 	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
@@ -379,13 +381,14 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
 			continue;
 		if (!node_online(nid))
 			continue;
-		if (node_test_and_set(nid, unlinked_nodes))
+		if (node_test_and_set(nid, *unlinked_nodes))
 			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));
 	}
+	NODEMASK_FREE(unlinked_nodes);
 	return 0;
 }
 
#11 lore raw

Re: [patch -mm] mm: slab allocate memory section nodemask for large systems

Quoted 7 lines · Alex Chiang

Any comments on this patch series?

Turns out that Kame-san's fear about a memory section spanning several nodes on certain architectures (S390) isn't really applicable and even if it were, we have code to handle situation anyway.

Quoted 9 lines

Kame-san was generally supportive of these convenience symlinks although he did not give a formal ACK.

David has given an ACK on the two patches that do real work, as well as supplied the below patch.

I can respin this series once more, including David's Acked-by:
and adding his patch if that makes life easier for you.

It's probably in Andrew's queue after getting back from the kernel summit, it would be best to wait a week or so.

maintainer
#12 lore raw

Re: [patch -mm] mm: slab allocate memory section nodemask for large systems

In reply to Alex Chiang
Quoted 2 lines · On Mon, 2 Nov 2009 13:47:26 -0700 Alex Chiang <[email protected]> wrote:

I can respin this series once more, including David's Acked-by:
and adding his patch if that makes life easier for you.

Yes, please redo and resend.

The prerequisite Documentation/ patches are a bit of a mess - some have been cherrypicked into Greg's tree I believe and some haven't. So please also send out whatever is needed to bring linux-next up to date.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#13 lore raw

Re: [patch -mm] mm: slab allocate memory section nodemask for large systems

Quoted 4 lines · Andrew Morton

The prerequisite Documentation/ patches are a bit of a mess - some have been cherrypicked into Greg's tree I believe and some haven't. So please also send out whatever is needed to bring linux-next up to date.

I'm not aware of any prerequisites for this patchset, Alex's documentation changes have already been merged by Linus.

#14 lore raw

Re: [patch -mm] mm: slab allocate memory section nodemask for large systems

* David Rientjes <[email protected]>:

Quoted 5 lines · Andrew Morton
Quoted 4 lines

The prerequisite Documentation/ patches are a bit of a mess - some have been cherrypicked into Greg's tree I believe and some haven't. So please also send out whatever is needed to bring linux-next up to date.

Thanks, I'll respin.

Quoted 2 lines

I'm not aware of any prerequisites for this patchset, Alex's documentation changes have already been merged by Linus.

Correct. So I'll respin this series against... Linus's tree? Or maybe mmotm? Please advise.

Thanks,
/ac

maintainer
#15 lore raw

Re: [patch -mm] mm: slab allocate memory section nodemask for large systems

Quoted 5 lines · On Tue, 10 Nov 2009 14:26:29 -0700 Alex Chiang <[email protected]> wrote:
Quoted 2 lines

I'm not aware of any prerequisites for this patchset, Alex's documentation changes have already been merged by Linus.

Correct. So I'll respin this series against... Linus's tree? Or maybe mmotm? Please advise.

It appears that Linus's tree will be an OK base.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#16 lore raw

PATCH v2 2/5 mm: refactor register_cpu_under_node()

In reply to Alex Chiang

By returning early if the node is not online, we can unindent the interesting code by one level.

No functional change.

---

 drivers/base/node.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
drivers/base/node.c +11 -9
index 3108b21..ef7dd22 100644
@@ -227,16 +227,18 @@ struct node node_devices[MAX_NUMNODES];
  */
 int register_cpu_under_node(unsigned int cpu, unsigned int nid)
 {
-	if (node_online(nid)) {
-		struct sys_device *obj = get_cpu_sysdev(cpu);
-		if (!obj)
-			return 0;
-		return sysfs_create_link(&node_devices[nid].sysdev.kobj,
-					 &obj->kobj,
-					 kobject_name(&obj->kobj));
-	 }
+	struct sys_device *obj;
 
-	return 0;
+	if (!node_online(nid))
+		return 0;
+
+	obj = get_cpu_sysdev(cpu);
+	if (!obj)
+		return 0;
+
+	return sysfs_create_link(&node_devices[nid].sysdev.kobj,
+				&obj->kobj,
+				kobject_name(&obj->kobj));
 }
 
 int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#17 lore raw

PATCH v2 3/5 mm: refactor unregister_cpu_under_node()

In reply to Alex Chiang

By returning early if the node is not online, we can unindent the interesting code by two levels.

No functional change.

---

 drivers/base/node.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
drivers/base/node.c +12 -6
index ef7dd22..ffda067 100644
@@ -243,12 +243,18 @@ int register_cpu_under_node(unsigned int cpu, unsigned int nid)
 
 int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
 {
-	if (node_online(nid)) {
-		struct sys_device *obj = get_cpu_sysdev(cpu);
-		if (obj)
-			sysfs_remove_link(&node_devices[nid].sysdev.kobj,
-					 kobject_name(&obj->kobj));
-	}
+	struct sys_device *obj;
+
+	if (!node_online(nid))
+		return 0;
+
+	obj = get_cpu_sysdev(cpu);
+	if (!obj)
+		return 0;
+
+	sysfs_remove_link(&node_devices[nid].sysdev.kobj,
+			  kobject_name(&obj->kobj));
+
 	return 0;
 }
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#18 lore raw

PATCH v2 4/5 mm: add numa node symlink for cpu devices in sysfs

In reply to Alex Chiang

You can discover which CPUs belong to a NUMA node by examining /sys/devices/system/node/node#/

However, it's not convenient to go in the other direction, when looking at /sys/devices/system/cpu/cpu#/

Yes, you can muck about in sysfs, but adding these symlinks makes life a lot more convenient.

---

 drivers/base/node.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
drivers/base/node.c +10 -1
index ffda067..24fa962 100644
@@ -227,6 +227,7 @@ struct node node_devices[MAX_NUMNODES];
  */
 int register_cpu_under_node(unsigned int cpu, unsigned int nid)
 {
+	int ret;
 	struct sys_device *obj;
 
 	if (!node_online(nid))
@@ -236,9 +237,15 @@ int register_cpu_under_node(unsigned int cpu, unsigned int nid)
 	if (!obj)
 		return 0;
 
-	return sysfs_create_link(&node_devices[nid].sysdev.kobj,
+	ret = sysfs_create_link(&node_devices[nid].sysdev.kobj,
 				&obj->kobj,
 				kobject_name(&obj->kobj));
+	if (ret)
+		return ret;
+
+	return sysfs_create_link(&obj->kobj,
+				 &node_devices[nid].sysdev.kobj,
+				 kobject_name(&node_devices[nid].sysdev.kobj));
 }
 
 int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
@@ -254,6 +261,8 @@ int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
 
 	sysfs_remove_link(&node_devices[nid].sysdev.kobj,
 			  kobject_name(&obj->kobj));
+	sysfs_remove_link(&obj->kobj,
+			  kobject_name(&node_devices[nid].sysdev.kobj));
 
 	return 0;
 }

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v2 4/5
#19 lore raw

Re: [PATCH v2 4/5] mm: add numa node symlink for cpu devices in sysfs

Quoted 10 lines · Alex Chiang

You can discover which CPUs belong to a NUMA node by examining /sys/devices/system/node/node#/

However, it's not convenient to go in the other direction, when looking at /sys/devices/system/cpu/cpu#/

Yes, you can muck about in sysfs, but adding these symlinks makes life a lot more convenient.

#20 lore raw

PATCH v2 5/5 Documentation: ABI: /sys/devices/system/cpu/cpu#/node

In reply to Alex Chiang

Describe NUMA node symlink created for CPUs when CONFIG_NUMA is set.

---

 Documentation/ABI/testing/sysfs-devices-system-cpu |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
Documentation/ABI/testing/sysfs-devices-system-cpu +15 -0
index b400c34..67813ae 100644
@@ -79,6 +79,21 @@ Description:	Discover and change the online state of a CPU.
 
 		For more information, please read Documentation/cpu-hotplug.txt
 
+
+What:		/sys/devices/system/cpu/cpu#/node
+Date:		October 2009
+Contact:	Linux memory management mailing list <[email protected]>
+Description:	Discover NUMA node a CPU belongs to
+
+		When CONFIG_NUMA is enabled, a symbolic link that points
+		to the corresponding NUMA node directory.
+
+		For example, the following symlink is created for cpu42
+		in NUMA node 2:
+
+		/sys/devices/system/cpu/cpu42/node2 -> ../../node/node2
+
+
 What:		/sys/devices/system/cpu/cpu#/topology/core_id
 		/sys/devices/system/cpu/cpu#/topology/core_siblings
 		/sys/devices/system/cpu/cpu#/topology/core_siblings_list

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>