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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39866CAC5AE for ; Wed, 24 Sep 2025 19:15:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 712308E0005; Wed, 24 Sep 2025 15:15:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6EA268E0001; Wed, 24 Sep 2025 15:15:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FFD98E0005; Wed, 24 Sep 2025 15:15:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4C94A8E0001 for ; Wed, 24 Sep 2025 15:15:49 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0211A138B08 for ; Wed, 24 Sep 2025 19:15:48 +0000 (UTC) X-FDA: 83925098418.15.6EEBBD9 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf26.hostedemail.com (Postfix) with ESMTP id A59A1140004 for ; Wed, 24 Sep 2025 19:15:46 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf26.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1758741347; a=rsa-sha256; cv=none; b=btn8QS00fTpAgyiJc+wOg44NNvYsXB+RTS2UChOuvWslZS0MpUYDgOCq5bZB7Ma8MHFdJI OyZ9003Y6tlgOT6YxFtXO/CAqyqWwO3stnnNmpPR0bk26KoQ1bhRPtkUfUu3/RV3q+byOO dmqiyEnhXa9d/uLO1RxiFewZKxEWVz8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf26.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1758741347; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2x7+Rm13mRhSwl91pdR3BNXkadzfUgRUZMh799UmRzk=; b=UTMkvj9VN5ZguF+90uZGrIBafyCL68DBKp5ShTAIlGaU/WTw7oeFPqe473CPcPRAfsjZfo gIXl9aUWUngTB25ER8ZgSpA10cq582CUkKXIk8afjEpTR3blIjJoYsaaob3dfpStgk7Lgh wphOIWx2+FONEQ1kWPQRo3qmB9OD3n8= Received: from localhost (mailhub4.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4cX64v3MX8z9sRr; Wed, 24 Sep 2025 21:15:43 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MjkCrWp6j8_X; Wed, 24 Sep 2025 21:15:43 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4cX64v2BmNz9sRk; Wed, 24 Sep 2025 21:15:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2A1358B770; Wed, 24 Sep 2025 21:15:43 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id WzjUaTohc-zd; Wed, 24 Sep 2025 21:15:43 +0200 (CEST) Received: from [192.168.235.99] (unknown [192.168.235.99]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1F2AA8B763; Wed, 24 Sep 2025 21:15:40 +0200 (CEST) Message-ID: Date: Wed, 24 Sep 2025 21:15:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] drivers/base/node: merge register_one_node() and register_node() to a single function. To: Donet Tom , Andrew Morton , David Hildenbrand , Oscar Salvador Cc: Ritesh Harjani , Aboorva Devarajan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Madhavan Srinivasan , linuxppc-dev@lists.ozlabs.org, Peter Zijlstra , Ingo Molnar , x86@kernel.org, Greg Kroah-Hartman , Danilo Krummrich , Mike Rapoport , Dave Jiang References: <40257b5228dec05e5b252f02438608eb8d681a2d.1758736423.git.donettom@linux.ibm.com> From: Christophe Leroy Content-Language: fr-FR In-Reply-To: <40257b5228dec05e5b252f02438608eb8d681a2d.1758736423.git.donettom@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: A59A1140004 X-Stat-Signature: dzqmxzx3r4wijigxrdz61495etnxczum X-Rspam-User: X-HE-Tag: 1758741346-353817 X-HE-Meta: U2FsdGVkX1/cQ8GN6p1U0MKiOQm0a47fL0nnNowWJziAKKoJ8wOG7qXwC4c1l8FtlRPWc6vA7DHVJWHH0GM5mnO8SbPQJI2PTidqfsLokFbKOBK09HTKU9D8PshpjQHGhUxHCvU9iErSznZybyopHUEiAkUb3UQEHff0VfaFqXGQrg5dcTfLKDSqb/rPdwpmR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DDesG2boFTriZTkZzDk3mQToJKh44kdsskk0wZdf5bsoKPRavoZmamc35j8pMrmgN2+CUiy/T8SvtE/csKhcSw= 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: List-Subscribe: List-Unsubscribe: Le 24/09/2025 à 20:40, Donet Tom a écrit : > register_one_node() and register_node() are small functions. > This patch merges them into a single function named register_node() > to improve code readability. This is unclear. What it really does is it folds register_node() into its only caller which is register_one_node() and then it renames register_one_node() into register_node(). > > No functional changes are introduced. > > Signed-off-by: Donet Tom > --- > arch/powerpc/platforms/pseries/pci_dlpar.c | 2 +- > arch/x86/mm/numa.c | 4 +- > drivers/base/node.c | 52 +++++++++------------- > include/linux/node.h | 4 +- > mm/memory_hotplug.c | 4 +- > mm/mm_init.c | 2 +- > 6 files changed, 28 insertions(+), 40 deletions(-) > > diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c > index aeb8633a3d00..8c77ec7980de 100644 > --- a/arch/powerpc/platforms/pseries/pci_dlpar.c > +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c > @@ -29,7 +29,7 @@ struct pci_controller *init_phb_dynamic(struct device_node *dn) > nid = of_node_to_nid(dn); > if (likely((nid) >= 0)) { > if (!node_online(nid)) { > - if (register_one_node(nid)) { > + if (register_node(nid)) { > pr_err("PCI: Failed to register node %d\n", nid); > } else { > update_numa_distance(dn); > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c > index c24890c40138..7a97327140df 100644 > --- a/arch/x86/mm/numa.c > +++ b/arch/x86/mm/numa.c > @@ -262,7 +262,7 @@ void __init init_gi_nodes(void) > * bringup_nonboot_cpus > * cpu_up > * __try_online_node > - * register_one_node > + * register_node > * because node_subsys is not initialized yet. > * TODO remove dependency on node_online > */ > @@ -303,7 +303,7 @@ void __init init_cpu_to_node(void) > * bringup_nonboot_cpus > * cpu_up > * __try_online_node > - * register_one_node > + * register_node > * because node_subsys is not initialized yet. > * TODO remove dependency on node_online > */ > diff --git a/drivers/base/node.c b/drivers/base/node.c > index 6b6e55a98b79..eab620e29c78 100644 > --- a/drivers/base/node.c > +++ b/drivers/base/node.c > @@ -638,33 +638,6 @@ static void node_device_release(struct device *dev) > kfree(to_node(dev)); > } > > -/* > - * register_node - Setup a sysfs device for a node. > - * @num - Node number to use when creating the device. > - * > - * Initialize and register the node device. > - */ > -static int register_node(struct node *node, int num) > -{ > - int error; > - > - node->dev.id = num; > - node->dev.bus = &node_subsys; > - node->dev.release = node_device_release; > - node->dev.groups = node_dev_groups; > - error = device_register(&node->dev); > - > - if (error) { > - put_device(&node->dev); > - } else { > - hugetlb_register_node(node); > - compaction_register_node(node); > - reclaim_register_node(node); > - } > - > - return error; > -} > - > /** > * unregister_node - unregister a node device > * @node: node going away > @@ -869,7 +842,13 @@ void register_memory_blocks_under_node_hotplug(int nid, unsigned long start_pfn, > } > #endif /* CONFIG_MEMORY_HOTPLUG */ > > -int register_one_node(int nid) > +/* > + * register_node - Setup a sysfs device for a node. > + * @nid - Node number to use when creating the device. > + * > + * Initialize and register the node device. > + */ > +int register_node(int nid) > { > int error; > int cpu; > @@ -880,14 +859,23 @@ int register_one_node(int nid) > return -ENOMEM; > > INIT_LIST_HEAD(&node->access_list); > - node_devices[nid] = node; > > - error = register_node(node_devices[nid], nid); > + node->dev.id = nid; > + node->dev.bus = &node_subsys; > + node->dev.release = node_device_release; > + node->dev.groups = node_dev_groups; > + > + error = device_register(&node->dev); > if (error) { > - node_devices[nid] = NULL; > + put_device(&node->dev); > return error; > } > > + node_devices[nid] = node; > + hugetlb_register_node(node); > + compaction_register_node(node); > + reclaim_register_node(node); > + > /* link cpu under this node */ > for_each_present_cpu(cpu) { > if (cpu_to_node(cpu) == nid) > @@ -980,7 +968,7 @@ void __init node_dev_init(void) > * to already created cpu devices. > */ > for_each_online_node(i) { > - ret = register_one_node(i); > + ret = register_node(i); > if (ret) > panic("%s() failed to add node: %d\n", __func__, ret); > } > diff --git a/include/linux/node.h b/include/linux/node.h > index 2c7529335b21..4dcf876cd0b4 100644 > --- a/include/linux/node.h > +++ b/include/linux/node.h > @@ -168,7 +168,7 @@ static inline int hotplug_node_notifier(notifier_fn_t fn, int pri) > #ifdef CONFIG_NUMA > extern void node_dev_init(void); > /* Core of the node registration - only memory hotplug should use this */ > -extern int register_one_node(int nid); > +extern int register_node(int nid); extern keyword is pointless on functions prototypes. checkpatch.pl usually complains about that. I know previous prototype was extern and all surrounding also are, but it is not because mistakes were done in the past that you have to continue doing the same mistakes. > extern void unregister_one_node(int nid); > extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); > extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); > @@ -181,7 +181,7 @@ extern int register_memory_node_under_compute_node(unsigned int mem_nid, > static inline void node_dev_init(void) > { > } > -static inline int register_one_node(int nid) > +static inline int register_node(int nid) > { > return 0; > } > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 0be83039c3b5..6c050d867031 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1311,7 +1311,7 @@ static int __try_online_node(int nid, bool set_node_online) > > if (set_node_online) { > node_set_online(nid); > - ret = register_one_node(nid); > + ret = register_node(nid); > BUG_ON(ret); > } > out: > @@ -1542,7 +1542,7 @@ int add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags) > goto error_memblock_remove; > if (ret) { > node_set_online(nid); > - ret = register_one_node(nid); > + ret = register_node(nid); > if (WARN_ON(ret)) { > node_set_offline(nid); > goto error_memblock_remove; > diff --git a/mm/mm_init.c b/mm/mm_init.c > index df614556741a..e1a19a3dadd7 100644 > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -1909,7 +1909,7 @@ void __init free_area_init(unsigned long *max_zone_pfn) > free_area_init_node(nid); > > /* > - * No sysfs hierarchy will be created via register_one_node() > + * No sysfs hierarchy will be created via register_node() > *for memory-less node because here it's not marked as N_MEMORY > *and won't be set online later. The benefit is userspace > *program won't be confused by sysfs files/directories of