diff mbox series

mm, memory_hotplug: pass next_memory_node to new_page_nodemask()

Message ID 20181213032744.68323-1-richard.weiyang@gmail.com (mailing list archive)
State New, archived
Headers show
Series mm, memory_hotplug: pass next_memory_node to new_page_nodemask() | expand

Commit Message

Wei Yang Dec. 13, 2018, 3:27 a.m. UTC
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.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 mm/memory_hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Yang Dec. 13, 2018, 4:03 a.m. UTC | #1
On Thu, Dec 13, 2018 at 11:27:44AM +0800, Wei Yang wrote:
>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.

>This patch pass next_memory_node as preferred_nid to new_page_nodemask()
>to fix it.
>
>Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>---
> mm/memory_hotplug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>index 6910e0eea074..0c075aac0a81 100644
>--- a/mm/memory_hotplug.c
>+++ b/mm/memory_hotplug.c
>@@ -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)
>-- 
>2.15.1
kernel test robot Dec. 13, 2018, 8:10 p.m. UTC | #2
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
diff mbox series

Patch

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 6910e0eea074..0c075aac0a81 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -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)