Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Oscar Salvador (SUSE)" <osalvador@kernel.org>
To: Qiliang Yuan <qiliang.yuan@linux.dev>
Cc: David Hildenbrand <david@kernel.org>,
	Oscar Salvador <osalvador@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	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
Date: Mon, 30 Nov 2026 20:04:42 +0100	[thread overview]
Message-ID: <aw3Iyk4do3F3qXyd@localhost.localdomain> (raw)
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 <qiliang.yuan@linux.dev>

Acked-by: Oscar Salvador (SUSE) <osalvador@kernel.org>

 

-- 
Oscar Salvador
SUSE Labs


      parent reply	other threads:[~2026-11-30 19:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  6:37 [PATCH] mm/memory_hotplug: return early from try_online_node() for online nodes Qiliang Yuan
2026-11-30 10:54 ` David Hildenbrand (Arm)
2026-11-30 10:56 ` David Hildenbrand
2026-11-30 19:04 ` Oscar Salvador (SUSE) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw3Iyk4do3F3qXyd@localhost.localdomain \
    --to=osalvador@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=qiliang.yuan@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox