From: Thomas Gleixner <tglx@linutronix.de>
To: Vishal Chourasia <vishalc@linux.ibm.com>,
peterz@infradead.org, aboorvad@linux.ibm.com
Cc: boqun.feng@gmail.com, frederic@kernel.org, joelagnelf@nvidia.com,
josh@joshtriplett.org, linux-kernel@vger.kernel.org,
neeraj.upadhyay@kernel.org, paulmck@kernel.org,
rcu@vger.kernel.org, rostedt@goodmis.org, srikar@linux.ibm.com,
sshegde@linux.ibm.com, urezki@gmail.com, samir@linux.ibm.com,
vishalc@linux.ibm.com
Subject: Re: [PATCH v3 1/2] cpuhp: Optimize SMT switch operation by batching lock acquisition
Date: Wed, 25 Mar 2026 20:09:17 +0100 [thread overview]
Message-ID: <87ikajenfm.ffs@tglx> (raw)
In-Reply-To: <20260218083915.660252-4-vishalc@linux.ibm.com>
On Wed, Feb 18 2026 at 14:09, Vishal Chourasia wrote:
> From: Joel Fernandes <joelagnelf@nvidia.com>
>
> Bulk CPU hotplug operations, such as an SMT switch operation, requires
> hotplugging multiple CPUs. The current implementation takes
> cpus_write_lock() for each individual CPU, causing multiple slow grace
> period requests.
>
> Introduce cpu_up_locked() and cpu_down_locked() that assume the caller
> already holds cpus_write_lock(). The cpuhp_smt_enable() and
> cpuhp_smt_disable() functions are updated to hold the lock once around
> the entire loop, rather than for each individual CPU.
>
> Link: https://lore.kernel.org/all/20260113090153.GS830755@noisy.programming.kicks-ass.net/
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
You dropped Joel's Signed-off-by ....
> -/* Requires cpu_add_remove_lock to be held */
> -static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
> +/* Requires cpu_add_remove_lock and cpus_write_lock to be held */
> +static int __ref cpu_down_locked(unsigned int cpu, int tasks_frozen,
> enum cpuhp_state target)
No line break required. You have 100 chars. If you still need one:
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html
> */
> if (cpumask_any_and(cpu_online_mask,
> housekeeping_cpumask(HK_TYPE_DOMAIN)) >= nr_cpu_ids) {
> - ret = -EBUSY;
> - goto out;
> + return -EBUSY;
> }
Please remove the brackets. They are not longer required. All over the place.
> +static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
> + enum cpuhp_state target)
> +{
> +
> + int ret;
> + cpus_write_lock();
Coding style...
> + ret = cpu_down_locked(cpu, tasks_frozen, target);
> cpus_write_unlock();
> arch_smt_update();
> return ret;
> @@ -2659,6 +2674,16 @@ int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
> int cpu, ret = 0;
>
> cpu_maps_update_begin();
> + if (cpu_hotplug_offline_disabled) {
> + ret = -EOPNOTSUPP;
> + goto out;
> + }
> + if (cpu_hotplug_disabled) {
> + ret = -EBUSY;
> + goto out;
> + }
> + /* Hold cpus_write_lock() for entire batch operation. */
> + cpus_write_lock();
.... for the entire ...
And please visiually separate things. Newlines exist for a reason.
Thanks,
tglx
next prev parent reply other threads:[~2026-03-25 19:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 8:39 [PATCH v3 0/2] cpuhp: Improve SMT switch time via lock batching and RCU expedition Vishal Chourasia
2026-02-18 8:39 ` [PATCH v3 1/2] cpuhp: Optimize SMT switch operation by batching lock acquisition Vishal Chourasia
2026-03-25 19:09 ` Thomas Gleixner [this message]
2026-03-26 10:06 ` Vishal Chourasia
2026-02-18 8:39 ` [PATCH v3 2/2] cpuhp: Expedite RCU grace periods during SMT operations Vishal Chourasia
2026-02-27 1:13 ` Joel Fernandes
2026-03-02 11:47 ` Samir M
2026-03-06 5:44 ` Vishal Chourasia
2026-03-06 15:12 ` Paul E. McKenney
2026-03-20 18:49 ` Vishal Chourasia
2026-03-25 19:10 ` Thomas Gleixner
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=87ikajenfm.ffs@tglx \
--to=tglx@linutronix.de \
--cc=aboorvad@linux.ibm.com \
--cc=boqun.feng@gmail.com \
--cc=frederic@kernel.org \
--cc=joelagnelf@nvidia.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=samir@linux.ibm.com \
--cc=srikar@linux.ibm.com \
--cc=sshegde@linux.ibm.com \
--cc=urezki@gmail.com \
--cc=vishalc@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.