[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ba692f24-794e-300d-248a-93165acd18e5@redhat.com>
Date: Mon, 7 Feb 2022 15:46:31 +0100
From: David Hildenbrand <david@...hat.com>
To: Miaohe Lin <linmiaohe@...wei.com>, akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] mm/memory_hotplug: clean up try_offline_node
On 07.02.22 14:36, 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@...wei.com>
> ---
> 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;
>
> /*
Reviewed-by: David Hildenbrand <david@...hat.com>
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists