linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] mm/memory_hotplug: clean up try_offline_node
Date: Tue, 8 Feb 2022 11:08:13 +0100	[thread overview]
Message-ID: <YgJBDaMf/lW2DCOS@localhost.localdomain> (raw)
In-Reply-To: <20220207133643.23427-4-linmiaohe@huawei.com>

On Mon, Feb 07, 2022 at 09:36:42PM +0800, Miaohe Lin wrote:
> We can use helper macro node_spanned_pages to check whether node spans
> pages. And we can change the parameter of check_cpu_on_node to nid as
> that's what it really cares. Thus we can further get rid of the local
> variable pgdat and improve the readability a bit.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Oscar Salvador <osalvador@suse.de>

> ---
>  mm/memory_hotplug.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 140809e60e9a..4b9eef861ee4 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -2008,12 +2008,12 @@ static int get_nr_vmemmap_pages_cb(struct memory_block *mem, void *arg)
>  	return mem->nr_vmemmap_pages;
>  }
>  
> -static int check_cpu_on_node(pg_data_t *pgdat)
> +static int check_cpu_on_node(int nid)
>  {
>  	int cpu;
>  
>  	for_each_present_cpu(cpu) {
> -		if (cpu_to_node(cpu) == pgdat->node_id)
> +		if (cpu_to_node(cpu) == nid)
>  			/*
>  			 * the cpu on this node isn't removed, and we can't
>  			 * offline this node.
> @@ -2047,7 +2047,6 @@ static int check_no_memblock_for_node_cb(struct memory_block *mem, void *arg)
>   */
>  void try_offline_node(int nid)
>  {
> -	pg_data_t *pgdat = NODE_DATA(nid);
>  	int rc;
>  
>  	/*
> @@ -2055,7 +2054,7 @@ void try_offline_node(int nid)
>  	 * offline it. A node spans memory after move_pfn_range_to_zone(),
>  	 * e.g., after the memory block was onlined.
>  	 */
> -	if (pgdat->node_spanned_pages)
> +	if (node_spanned_pages(nid))
>  		return;
>  
>  	/*
> @@ -2067,7 +2066,7 @@ void try_offline_node(int nid)
>  	if (rc)
>  		return;
>  
> -	if (check_cpu_on_node(pgdat))
> +	if (check_cpu_on_node(nid))
>  		return;
>  
>  	/*
> -- 
> 2.23.0
> 
> 

-- 
Oscar Salvador
SUSE Labs


  parent reply	other threads:[~2022-02-08 10:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 13:36 [PATCH 0/4] A few cleanup patches around memory_hotplug Miaohe Lin
2022-02-07 13:36 ` [PATCH 1/4] mm/memory_hotplug: remove obsolete comment of __add_pages Miaohe Lin
2022-02-07 14:41   ` David Hildenbrand
2022-02-07 20:12     ` Andrew Morton
2022-02-08 10:15   ` Oscar Salvador
2022-02-08 10:56     ` Miaohe Lin
2022-02-07 13:36 ` [PATCH 2/4] mm/memory_hotplug: avoid calling zone_intersects() for ZONE_NORMAL Miaohe Lin
2022-02-07 14:50   ` David Hildenbrand
2022-02-08 10:06   ` Oscar Salvador
2022-02-07 13:36 ` [PATCH 3/4] mm/memory_hotplug: clean up try_offline_node Miaohe Lin
2022-02-07 14:46   ` David Hildenbrand
2022-02-08 10:08   ` Oscar Salvador [this message]
2022-02-07 13:36 ` [PATCH 4/4] mm/memory_hotplug: fix misplaced comment in offline_pages Miaohe Lin
2022-02-07 14:45   ` David Hildenbrand
2022-02-08 10:12   ` Oscar Salvador

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=YgJBDaMf/lW2DCOS@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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