linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>,  Baoquan He <bhe@redhat.com>,
	Oscar Salvador <osalvador@suse.de>
Subject: Re: [PATCH RFC 1/2] mm/memory_hotplug: no need to init new pgdat with node_start_pfn
Date: Thu, 16 Apr 2020 16:11:56 +0200	[thread overview]
Message-ID: <CAM9Jb+iBAHr+UjxZBUGugQ_+9Z0a6CPAp8gXWorE57_rOQ9xqA@mail.gmail.com> (raw)
In-Reply-To: <20200416104707.20219-2-david@redhat.com>

> A hotadded node/pgdat will span no pages at all, until memory is moved to
> the zone/node via move_pfn_range_to_zone() -> resize_pgdat_range - e.g.,
> when onlining memory blocks. We don't have to initialize the
> node_start_pfn to the memory we are adding.
>
> Note: we'll also end up with pgdat->node_start_pfn == 0 when offlined the
> last memory block belonging to a node (via remove_pfn_range_from_zone()->
> update_pgdat_span()).
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Baoquan He <bhe@redhat.com>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  mm/memory_hotplug.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 47cf6036eb31..9b15ce465be2 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -866,10 +866,9 @@ static void reset_node_present_pages(pg_data_t *pgdat)
>  }
>
>  /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
> -static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
> +static pg_data_t __ref *hotadd_new_pgdat(int nid)
>  {
>         struct pglist_data *pgdat;
> -       unsigned long start_pfn = PFN_DOWN(start);
>
>         pgdat = NODE_DATA(nid);
>         if (!pgdat) {
> @@ -899,9 +898,8 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
>         }
>
>         /* we can use NODE_DATA(nid) from here */
> -
>         pgdat->node_id = nid;
> -       pgdat->node_start_pfn = start_pfn;
> +       pgdat->node_start_pfn = 0;
>
>         /* init node's zones as empty zones, we don't have any present pages.*/
>         free_area_init_core_hotplug(nid);
> @@ -936,7 +934,6 @@ static void rollback_node_hotadd(int nid)
>  /**
>   * try_online_node - online a node if offlined
>   * @nid: the node ID
> - * @start: start addr of the node
>   * @set_node_online: Whether we want to online the node
>   * called by cpu_up() to online a node without onlined memory.
>   *
> @@ -945,7 +942,7 @@ static void rollback_node_hotadd(int nid)
>   * 0 -> the node is already online
>   * -ENOMEM -> the node could not be allocated
>   */
> -static int __try_online_node(int nid, u64 start, bool set_node_online)
> +static int __try_online_node(int nid, bool set_node_online)
>  {
>         pg_data_t *pgdat;
>         int ret = 1;
> @@ -953,7 +950,7 @@ static int __try_online_node(int nid, u64 start, bool set_node_online)
>         if (node_online(nid))
>                 return 0;
>
> -       pgdat = hotadd_new_pgdat(nid, start);
> +       pgdat = hotadd_new_pgdat(nid);
>         if (!pgdat) {
>                 pr_err("Cannot online node %d due to NULL pgdat\n", nid);
>                 ret = -ENOMEM;
> @@ -977,7 +974,7 @@ int try_online_node(int nid)
>         int ret;
>
>         mem_hotplug_begin();
> -       ret =  __try_online_node(nid, 0, true);
> +       ret =  __try_online_node(nid, true);
>         mem_hotplug_done();
>         return ret;
>  }
> @@ -1031,7 +1028,7 @@ int __ref add_memory_resource(int nid, struct resource *res)
>          */
>         memblock_add_node(start, size, nid);
>
> -       ret = __try_online_node(nid, start, false);
> +       ret = __try_online_node(nid, false);
>         if (ret < 0)
>                 goto error;
>         new_node = ret;
> --

Looks right thing to me. Will wait for others to comment.

Acked-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>

> 2.25.1
>


  reply	other threads:[~2020-04-16 14:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 10:47 [PATCH RFC 0/2] mm/memory_hotplug: handle memblocks only with CONFIG_ARCH_KEEP_MEMBLOCK David Hildenbrand
2020-04-16 10:47 ` [PATCH RFC 1/2] mm/memory_hotplug: no need to init new pgdat with node_start_pfn David Hildenbrand
2020-04-16 14:11   ` Pankaj Gupta [this message]
2020-04-21 12:30   ` Michal Hocko
2020-04-21 12:35     ` David Hildenbrand
2020-04-21 12:52       ` Michal Hocko
2020-04-21 13:06         ` David Hildenbrand
2020-04-22  8:21           ` Michal Hocko
2020-04-22  8:32             ` David Hildenbrand
2020-04-22 10:00               ` Michal Hocko
2020-04-16 10:47 ` [PATCH RFC 2/2] mm/memory_hotplug: handle memblocks only with CONFIG_ARCH_KEEP_MEMBLOCK David Hildenbrand
2020-04-16 17:09   ` Mike Rapoport
2020-04-21 12:39   ` Michal Hocko
2020-04-21 12:41     ` David Hildenbrand

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=CAM9Jb+iBAHr+UjxZBUGugQ_+9Z0a6CPAp8gXWorE57_rOQ9xqA@mail.gmail.com \
    --to=pankaj.gupta.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).