From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7E21C433F5 for ; Tue, 8 Feb 2022 10:08:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 387078D0002; Tue, 8 Feb 2022 05:08:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 339048D0001; Tue, 8 Feb 2022 05:08:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 07A238D0002; Tue, 8 Feb 2022 05:08:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id E0F948D0001 for ; Tue, 8 Feb 2022 05:08:17 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A304F8249980 for ; Tue, 8 Feb 2022 10:08:17 +0000 (UTC) X-FDA: 79119187434.08.C17B4D3 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf22.hostedemail.com (Postfix) with ESMTP id 26A42C0003 for ; Tue, 8 Feb 2022 10:08:17 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 153041F387; Tue, 8 Feb 2022 10:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1644314896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XmeLDl/J1mI/gB/JKUMLSDJLLe4Hs7OYJYeo3mn+Cmo=; b=sYr9Pb3vAIjysu0Gm3KSChFAGbSZSqkT7xOWY8lnVfmkZthFwQeVDxxct8ApVYiHXP/Ron Kl3aLSviu8BGN3MebxRLSLixqmv4tFfTqVkUIDZW1yO1XKBrDriZTDBW8kXv7//MLDzU5S ibq1U/gYGz9x46QcZpElNY5m4iKjduI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1644314896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XmeLDl/J1mI/gB/JKUMLSDJLLe4Hs7OYJYeo3mn+Cmo=; b=8/yfyyoBZtUZan7cTCKmjuo9j2pfwo4S01jcmj6XnTqkd5KCQ8Ll/aAt7VvvYh+GLa8RLB z7h5IlXS9frz3LCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B68C513BF9; Tue, 8 Feb 2022 10:08:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id lw8HKQ9BAmJ0cAAAMHmgww (envelope-from ); Tue, 08 Feb 2022 10:08:15 +0000 Date: Tue, 8 Feb 2022 11:08:13 +0100 From: Oscar Salvador To: Miaohe Lin 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 Message-ID: References: <20220207133643.23427-1-linmiaohe@huawei.com> <20220207133643.23427-4-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220207133643.23427-4-linmiaohe@huawei.com> X-Rspamd-Queue-Id: 26A42C0003 X-Stat-Signature: 1xtiud5c1zwqygyyxhp5wnn59ikxp8cp Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=sYr9Pb3v; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="8/yfyyoB"; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf22.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.29 as permitted sender) smtp.mailfrom=osalvador@suse.de X-Rspamd-Server: rspam06 X-Rspam-User: X-HE-Tag: 1644314897-910126 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Oscar Salvador > --- > 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