From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796065489; b=dgNwlz3+2YO/Fk4nC3+QUZZT5raXzrCuSYSzPZcJZGzcE87eLd8mNom4oPhqjEEtL5Ba Q7W2tCkqxsDutfPzBHyQdJJUO4DqLPSYJNbboWL+jOyhddV46BKZDr1MhCclxnnww4Vkg 9w3UJ+fYAQlVmLynQvpJ5jCHfDnUIcvjOYPFBkTwiSK/+tCXfVoWMt/T2dB74fOE/q1nx 3+08QkEECXwBfj/gdtS+wpxo7lM3sV409QF307Ks6fHbH1y4kLIK290gRsWDOnegeSaSB wgEl6P1TOBLmrR6cRtkMyDWF6R4y/6l18iqZ8MlUAKzwoQnpDSDjR1YbbmNxvNbvRSA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796065489; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=OJgmQUWZHyA8JDovBFdSyEdRGwpoY8IL8IttDq6ijh8=; b=DkbJeuz/7GlizdXMkO64W0axT+7aI4+rEEW/Sxwnt/r0wK9KuZdx7xL1/dbbmZxMud3+ Pix2WSr8FQtDdGH4pWFqw+qZ12asriWvikGItL0gVFF0YVkLRKuMuqCG66W8zKPLnbdL8 IZD3FA+7oVrZ+XJDDwn+WTjW4bDm3XVBi3camTTctFlcjAnnupeCJN44NQ7zd/uuWNqK0 S8QtikT2cTaqMM5IPwURJjQPNv1KpwC/bWGW0rqwIY6vaBANLFBknKbydxPwRoQZq7S8q dR38p23on2ME6mB63zgJvYFAkRV/lx9y8rrME3rNXErYR87mD5nYz4frjgtya6ebsUA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XSlfJAiN; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70745606A325; Mon, 30 Nov 2026 19:04:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XSlfJAiN Received: by smtp.kernel.org (Postfix) with ESMTPSA id A23411F0089A; Mon, 30 Nov 2026 19:04:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796065488; bh=OJgmQUWZHyA8JDovBFdSyEdRGwpoY8IL8IttDq6ijh8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=XSlfJAiNEhIghpsiybhaq94PYzTNQsMgPqPkrtgsROWWU4QdKNDXnQXU3xUhDlgt4 diezK2ccYwTWgVRHztWCyo7dcfW7nAU+Kh4MxIhGB93dhO+FjWTKTyWQw8RC1yThw/ XzqD+abw2EJnTy0Gf1FLUz6yTAq4syfeJMILzDFDTfnq5CXYZsFXP4He7QDgK+HnKL QS1ZOgm5f3irGbsvJ/TifSw2mCfjIrkaJSJkVU1k39NH2+9YODFJ/ZE+nqXvo+HB3O XMWvgLa+rj9iM3/o5+rhOLFQZr/u1TG2m5LDqmoIWVQ7gxSlckBQ5bJ1h6FjnbQrQf xycw1TUNyLkqg== Date: Mon, 30 Nov 2026 20:04:42 +0100 From: "Oscar Salvador (SUSE)" To: Qiliang Yuan Cc: David Hildenbrand , Oscar Salvador , Andrew Morton , linux-mm@kvack.org, linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/memory_hotplug: return early from try_online_node() for online nodes Message-ID: References: <20261130-feat-memhp-try-online-node-v1-1-b65dd4a9af92@linux.dev> X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130-feat-memhp-try-online-node-v1-1-b65dd4a9af92@linux.dev> On Mon, Nov 30, 2026 at 01:37:51AM -0500, Qiliang Yuan wrote: > cpu_up() calls try_online_node() for the node of every CPU it brings up, > so that a CPU on a memoryless node that is not online yet gets its node > onlined first. try_online_node() takes mem_hotplug_lock for write with > mem_hotplug_begin() before it checks whether the node is online. > > mem_hotplug_lock is a percpu rwsem, and taking it for write waits for an > RCU grace period unless another writer released it shortly before. > Bringing a CPU online through sysfs, as done when hot-adding vCPUs to a > VM, therefore waits for a grace period although the node of the CPU is > almost always online already. > > Check node_online() before taking the lock. A node with present CPUs is > never offlined, see try_offline_node(), so the node of the CPU being > brought up cannot go offline concurrently. > > Onlining CPUs of a 32-vCPU VM through sysfs, base and patched kernels > alternating over 4 rounds of 5 runs, median of the 20 runs and > interquartile range in parentheses; "single" onlines one CPU 0.3 s after > taking it offline, "16 in a row" onlines CPUs 16-31 back to back: > > case before (ms) after (ms) change > single 24.8 (24.2-25.9) 16.7 (15.9-17.3) -33% > 16 in a row 143.1 (139.8-147.2) 130.0 (127.3-133.7) -9% > > Signed-off-by: Qiliang Yuan Acked-by: Oscar Salvador (SUSE) -- Oscar Salvador SUSE Labs