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 3F4E3C3ABB0 for ; Mon, 5 May 2025 07:57:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8710D6B0093; Mon, 5 May 2025 03:57:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 81F9C6B0095; Mon, 5 May 2025 03:57:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E5A86B0096; Mon, 5 May 2025 03:57:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4AAF96B0093 for ; Mon, 5 May 2025 03:57:45 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1BF59CB805 for ; Mon, 5 May 2025 07:57:47 +0000 (UTC) X-FDA: 83408100174.23.2CE0ECA Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf03.hostedemail.com (Postfix) with ESMTP id D07D820003 for ; Mon, 5 May 2025 07:57:44 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gqwPmKNg; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7fZHkoYb; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gqwPmKNg; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7fZHkoYb; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf03.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1746431865; a=rsa-sha256; cv=none; b=IZRXny7UisPVxebUJyoQ8LsIbFYABjcRybGCwflJg+hPNtsxjaD7xMoavaUz5oBENv/J3i 1Ii1a662CdDFE2cP0yoCxG0g/HhqGI2SQ3Z1fOb5a2iZIvwRf90mQFgbaWI2Elh29xMm8C C8Xq/h37UF20lhF+zOfmx3gjs9yFjRg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gqwPmKNg; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7fZHkoYb; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gqwPmKNg; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7fZHkoYb; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf03.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1746431865; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Jmv+7HBEy0fwKr1rMdE+zrW2njkxMCW/EyLYP7nagd8=; b=lQHHGumT6YDkH1L25Ed1ki8b6JOhSf2988V8olpWUn2Bgq5V33z1rFqhfVT5Dv8F4ryAab aDLohSCUDk84QlgTMSwCy1H/dwsIA5M1wlzbHMImO87Reg8oHBhvd/72m/34MUyaF+X0Qz I2CwSP6kGWY0Nan2Xf5t7OKOSdqBR/U= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1FC36216EE; Mon, 5 May 2025 07:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1746431863; 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=Jmv+7HBEy0fwKr1rMdE+zrW2njkxMCW/EyLYP7nagd8=; b=gqwPmKNg3cyqehi3l7OIb0wFb7kggE614ZS3RUh6F8O76llJSmc0bGcxOhFycMOY8pCjmZ AWhnj0rAhjM21IIebMD/FsvZi8kjOnutyELLmJBoelmU3xC7MlQlKTfZ60KS2tl0EjgO5U 4QpVPU2W0RgZrkgicdpIVGTqHuyw+2s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1746431863; 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=Jmv+7HBEy0fwKr1rMdE+zrW2njkxMCW/EyLYP7nagd8=; b=7fZHkoYbBYB6yYO8EmiYSqsGTdhqdKfoq4lzG+tLXFOKH4hWYvWW9bdOQp+G+7ErI1DEk4 zczkqI4otfXqMjBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1746431863; 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=Jmv+7HBEy0fwKr1rMdE+zrW2njkxMCW/EyLYP7nagd8=; b=gqwPmKNg3cyqehi3l7OIb0wFb7kggE614ZS3RUh6F8O76llJSmc0bGcxOhFycMOY8pCjmZ AWhnj0rAhjM21IIebMD/FsvZi8kjOnutyELLmJBoelmU3xC7MlQlKTfZ60KS2tl0EjgO5U 4QpVPU2W0RgZrkgicdpIVGTqHuyw+2s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1746431863; 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=Jmv+7HBEy0fwKr1rMdE+zrW2njkxMCW/EyLYP7nagd8=; b=7fZHkoYbBYB6yYO8EmiYSqsGTdhqdKfoq4lzG+tLXFOKH4hWYvWW9bdOQp+G+7ErI1DEk4 zczkqI4otfXqMjBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id EF78C13883; Mon, 5 May 2025 07:57:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8VC0N3VvGGhBUQAAD6G6ig (envelope-from ); Mon, 05 May 2025 07:57:41 +0000 Date: Mon, 5 May 2025 09:57:31 +0200 From: Oscar Salvador To: David Hildenbrand Cc: Donet Tom , Mike Rapoport , Zi Yan , Greg Kroah-Hartman , Andrew Morton , rafael@kernel.org, Danilo Krummrich , Ritesh Harjani , Jonathan Cameron , Alison Schofield , Yury Norov , Dave Jiang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/3] driver/base: Optimize memory block registration to reduce boot time Message-ID: References: <188fbfba-afb4-4db7-bbba-7689a96be931@redhat.com> <74c500dd-8d1c-4177-96c7-ddd51ca77306@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <74c500dd-8d1c-4177-96c7-ddd51ca77306@redhat.com> X-Rspamd-Action: no action X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: D07D820003 X-Stat-Signature: 5ygdur86ftiiism959ypumpzmjtuz5dj X-Rspam-User: X-HE-Tag: 1746431864-5980 X-HE-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grt9DgAEhl0/hFThtebR1V2Z/i/VAsLe13Ek2XEeQhE//i1j8glxrShbH3NjwhHqjT0hRkCGduXimGjMbDkiYl5ZAT9Lr27wYcVqycNK6MvObIkmo1b6lN929R1RYBeEIHhdx1X2bie9VYYxmpoiuaQ47cF29XARglXWAq3wLfzt9mPgiCOgc/GRfW3vykQHuq58yQ2tknZb+Zchs3HvLu9Q6STixpZ+wrNPYlITt6T8UQ== 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: On Mon, May 05, 2025 at 09:38:43AM +0200, David Hildenbrand wrote: > On 05.05.25 09:28, Oscar Salvador wrote: > > On Mon, May 05, 2025 at 09:16:48AM +0200, David Hildenbrand wrote: > > > memory hotplug code never calls register_one_node(), unless I am missing > > > something. > > > > > > During add_memory_resource(), we call __try_online_node(nid, false), meaning > > > we skip register_one_node(). > > > > > > The only caller of __try_online_node(nid, true) is try_online_node(), called > > > from CPU hotplug code, and I *guess* that is not required. > > > > Well, I guess this is because we need to link the cpus to the node. > > register_one_node() has two jobs: 1) register cpus belonging to the node > > and 2) register memory-blocks belonging to the node (if any). > > Ah, via __register_one_node() ... > > I would assume that an offline node > > (1) has no memory > (2) has no CPUs That is right. > When we *hotplug* either memory or CPUs, and we first online the node, there > is nothing to register. Because if there would be something, the node would > already be online. I think I do not understand this, but let us imagine the following scenario: - You craft a VM with qemu that has a numa node which is memoryless and cpuless. This node will be allocated in free_area_init()->alloc_offline_node_data() but it will not be marked online because it does not have any resources. Then if you create a cpu device and hotplug in there, this will trigger try_online_node() from the cpu callback and go all the way to __register_one_node() to link the hotplugged cpu to the corresponding node. Now, I do not see an issue with that. The only think that makes me go "meh", is that register_one_node() calls register_memory_blocks_under_node() blindly when there might not be any memory block to register (I am sure we bail out if we see that somewhere, but still feels kinda of "wrong"? -- Oscar Salvador SUSE Labs