From: Andrew Morton <akpm@linux-foundation.org>
To: osalvador@techadventures.net
Cc: mhocko@suse.com, vbabka@suse.cz, pasha.tatashin@oracle.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Oscar Salvador <osalvador@suse.de>
Subject: Re: [PATCH 1/4] mm/memory_hotplug: Make add_memory_resource use __try_online_node
Date: Wed, 20 Jun 2018 15:18:19 -0700 [thread overview]
Message-ID: <20180620151819.3f39226998bd80f7161fcea5@linux-foundation.org> (raw)
In-Reply-To: <20180601125321.30652-2-osalvador@techadventures.net>
On Fri, 1 Jun 2018 14:53:18 +0200 osalvador@techadventures.net wrote:
> From: Oscar Salvador <osalvador@suse.de>
>
> add_memory_resource() contains code to allocate a new node in case
> it is necessary.
> Since try_online_node() also hast some code for this purpose,
> let us make use of that and remove duplicate code.
>
> This introduces __try_online_node(), which is called by add_memory_resource()
> and try_online_node().
> __try_online_node() has two new parameters, start_addr of the node,
> and if the node should be onlined and registered right away.
> This is always wanted if we are calling from do_cpu_up(), but not
> when we are calling from memhotplug code.
> Nothing changes from the point of view of the users of try_online_node(),
> since try_online_node passes start_addr=0 and online_node=true to
> __try_online_node().
>
> ...
>
> @@ -1126,17 +1136,14 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)
> */
> memblock_add_node(start, size, nid);
>
> - new_node = !node_online(nid);
> - if (new_node) {
> - pgdat = hotadd_new_pgdat(nid, start);
> - ret = -ENOMEM;
> - if (!pgdat)
> - goto error;
> - }
> + ret = __try_online_node (nid, start, false);
> + new_node = !!(ret > 0);
I don't think __try_online_node() will ever return a value greater than
zero. I assume what was meant was
new_node = !!(ret >= 0);
which may as well be
new_node = (ret >= 0);
since both sides have bool type.
The fact that testing didn't detect this is worrisome....
> + if (ret < 0)
> + goto error;
> +
>
> /* call arch's memory hotadd */
> ret = arch_add_memory(nid, start, size, NULL, true);
> -
> if (ret < 0)
> goto error;
>
>
> ...
>
next prev parent reply other threads:[~2018-06-20 22:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 12:53 [PATCH 0/4] Small cleanup for memoryhotplug osalvador
2018-06-01 12:53 ` [PATCH 1/4] mm/memory_hotplug: Make add_memory_resource use __try_online_node osalvador
2018-06-07 10:48 ` Jonathan Cameron
2018-06-20 22:18 ` Andrew Morton [this message]
2018-06-21 1:41 ` Pavel Tatashin
2018-06-21 7:33 ` Oscar Salvador
2018-06-01 12:53 ` [PATCH 2/4] mm/memory_hotplug: Call register_mem_sect_under_node osalvador
2018-06-21 2:03 ` Pavel Tatashin
2018-06-01 12:53 ` [PATCH 3/4] mm/memory_hotplug: Get rid of link_mem_sections osalvador
2018-06-21 2:35 ` Pavel Tatashin
2018-06-25 17:04 ` Jonathan Cameron
2018-06-25 17:34 ` Oscar Salvador
2018-06-01 12:53 ` [PATCH 4/4] mm/memory_hotplug: Drop unnecessary checks from register_mem_sect_under_node osalvador
2018-06-21 2:38 ` Pavel Tatashin
2018-06-07 10:42 ` [PATCH 0/4] Small cleanup for memoryhotplug Jonathan Cameron
2018-06-07 13:32 ` Oscar Salvador
2018-06-18 7:13 ` Oscar Salvador
2018-06-21 8:32 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180620151819.3f39226998bd80f7161fcea5@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=osalvador@techadventures.net \
--cc=pasha.tatashin@oracle.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox