Skip to contentSkip to conversation

mm, memory_hotplug: pass next_memory_node to new_page_nodemask()

PATCH In review Wei Yang 2 participants 3 messages Dec 13, 2018

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 mm, memory_hotplug: pass next_memory_node to new_page_nodemask()

As the document says new_page_nodemask() will try to allocate from a different node, but current behavior just do the opposite by passing current nid as preferred_nid to new_page_nodemask().

This patch pass next_memory_node as preferred_nid to new_page_nodemask() to fix it.

---
 mm/memory_hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory_hotplug.c +1 -1
index 6910e0eea074..0c075aac0a81 100644
@@ -1335,7 +1335,7 @@ static struct page *new_node_page(struct page *page, unsigned long private)
 	if (nodes_empty(nmask))
 		node_set(nid, nmask);
 
-	return new_page_nodemask(page, nid, &nmask);
+	return new_page_nodemask(page, next_memory_node(nid), &nmask);
 }
 
 #define NR_OFFLINE_AT_ONCE_PAGES	(256)
Signature · 1 line
2.15.1
author
#1 lore raw
Quoted 4 lines · Wei Yang

As the document says new_page_nodemask() will try to allocate from a different node, but current behavior just do the opposite by passing current nid as preferred_nid to new_page_nodemask().

Hmm... my understanding is not correct.

Sorry for the broadcasting.

Quoted 23 lines

This patch pass next_memory_node as preferred_nid to new_page_nodemask() to fix it.

---
mm/memory_hotplug.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory_hotplug.c +1 -1
index 6910e0eea074..0c075aac0a81 100644
@@ -1335,7 +1335,7 @@ static struct page *new_node_page(struct page *page, unsigned long private)
 	if (nodes_empty(nmask))
 		node_set(nid, nmask);
 
-	return new_page_nodemask(page, nid, &nmask);
+	return new_page_nodemask(page, next_memory_node(nid), &nmask);
 }
 
 #define NR_OFFLINE_AT_ONCE_PAGES	(256)
Signature · 1 line
2.15.1
Signature · 2 lines
Wei Yang
Help you, Help me
#2 lore raw
In reply to Wei Yang
Thank you for the patch! Yet something to improve:

Hi Wei,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.20-rc6 next-20181213]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Wei-Yang/mm-memory_hotplug-pass-next_memory_node-to-new_page_nodemask/20181214-030950
config: x86_64-randconfig-x009-201849 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:

        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

mm/memory_hotplug.c: In function 'new_node_page':

>> mm/memory_hotplug.c:1339:33: error: implicit declaration of function 'next_memory_node'; did you mean 'first_memory_node'? [-Werror=implicit-function-declaration]
     return new_page_nodemask(page, next_memory_node(nid), &nmask);
                                    ^~~~~~~~~~~~~~~~
                                    first_memory_node

cc1: some warnings being treated as errors

vim +1339 mm/memory_hotplug.c

1324
1325 static struct page *new_node_page(struct page *page, unsigned long private)
1326 {
1327 int nid = page_to_nid(page);
1328 nodemask_t nmask = node_states[N_MEMORY];
1329
1330 /*
1331 * try to allocate from a different node but reuse this node if there
1332 * are no other online nodes to be used (e.g. we are offlining a part
1333 * of the only existing node)
1334 */
1335 node_clear(nid, nmask);
1336 if (nodes_empty(nmask))
1337 node_set(nid, nmask);
1338

> 1339		return new_page_nodemask(page, next_memory_node(nid), &nmask);

1340 }
1341

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation