mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: "paulmck@kernel.org" <paulmck@kernel.org>
Cc: Vishal Chourasia <vishalc@linux.ibm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rcu@vger.kernel.org" <rcu@vger.kernel.org>,
	"aboorvad@linux.ibm.com" <aboorvad@linux.ibm.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"boqun.feng@gmail.com" <boqun.feng@gmail.com>,
	"frederic@kernel.org" <frederic@kernel.org>,
	"josh@joshtriplett.org" <josh@joshtriplett.org>,
	"neeraj.upadhyay@kernel.org" <neeraj.upadhyay@kernel.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"srikar@linux.ibm.com" <srikar@linux.ibm.com>,
	"sshegde@linux.ibm.com" <sshegde@linux.ibm.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"urezki@gmail.com" <urezki@gmail.com>,
	"samir@linux.ibm.com" <samir@linux.ibm.com>
Subject: Re: [PATCH v5 1/1] cpuhp: Expedite RCU when toggling system-wide SMT mode
Date: Thu, 12 Nov 2026 09:20:47 +0000	[thread overview]
Message-ID: <B6B9F4A3-954F-4FB5-B7E2-534CD785B18C@nvidia.com> (raw)
In-Reply-To: <f1a04d2f-367e-4be8-b313-31a73e15bcd0@paulmck-laptop>



> On Nov 12, 2026, at 3:30 AM, Paul E. McKenney <paulmck@kernel.org> wrote:
> 
> On Mon, Jun 15, 2026 at 09:55:16AM +0530, Vishal Chourasia wrote:
>> On large idle systems, changing system-wide SMT level using the sysfs
>> control interface still takes approximately 40-55 minutes. Changing SMT
>> levels is an user triggered operation generally done when systems are
>> fairly idle. This causes users to be blocked from doing other subsequent
>> work.
>> 
>> Analyzing the collected profile data during SMT level switch, showed
>> that CPU hotplug machinery was blocked on synchronize_rcu() calls.
>> 
>> Expedite RCU grace periods for the entire duration of triggered SMT
>> switch operation via the sysfs control interface. Individual CPU hotplug
>> operations via the online/offline interface are not affected.
>> 
>> On a PPC64 system with 400 CPUs:
>> 
>>  SMT8 to SMT1:
>>    before:  1m14s
>>    after:   3.2s   (~23x faster)
>> 
>>  SMT1 to SMT8:
>>    before:  2m27s
>>    after:   2.5s   (~58x faster)
>> 
>> On a large config system with 1920 CPUs, completion time improves from
>> ~1 hour to 5-6 minutes.
>> 
>> Tested-by: Samir <samir@linux.ibm.com>
>> Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
>> Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
> 
> From an RCU viewpoint:
> 
> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> 
> I am guessing that you will be taking this up some other path, but if
> you would like it to to via RCU, please let me know.

I do feel there is a strong case, as the change is simple and the performance issue is kind of ridiculous, and the authors have done due diligence. 

Since Paul has provided his tag and I am helping with 7.5 merge window for RCU, I will run some tests on this (no promises) but if someone does not want me to apply it - maybe now would be a great time to yell at me.

thanks,

Joel Fernandes

> 
>                            Thanx, Paul
> 
>> ---
>> include/linux/rcupdate.h | 8 ++++++++
>> kernel/cpu.c             | 4 ++++
>> kernel/rcu/rcu.h         | 4 ----
>> 3 files changed, 12 insertions(+), 4 deletions(-)
>> 
>> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
>> index bfa765132de8..b6bccf131f1c 100644
>> --- a/include/linux/rcupdate.h
>> +++ b/include/linux/rcupdate.h
>> @@ -1178,6 +1178,14 @@ rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
>> extern int rcu_expedited;
>> extern int rcu_normal;
>> 
>> +#ifdef CONFIG_TINY_RCU
>> +static inline void rcu_expedite_gp(void) { }
>> +static inline void rcu_unexpedite_gp(void) { }
>> +#else
>> +void rcu_expedite_gp(void);
>> +void rcu_unexpedite_gp(void);
>> +#endif
>> +
>> DEFINE_LOCK_GUARD_0(rcu, rcu_read_lock(), rcu_read_unlock())
>> DECLARE_LOCK_GUARD_0_ATTRS(rcu, __acquires_shared(RCU), __releases_shared(RCU))
>> 
>> diff --git a/kernel/cpu.c b/kernel/cpu.c
>> index bc4f7a9ba64e..6351da9dffdc 100644
>> --- a/kernel/cpu.c
>> +++ b/kernel/cpu.c
>> @@ -2658,6 +2658,7 @@ int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
>>    int cpu, ret = 0;
>> 
>>    cpu_maps_update_begin();
>> +    rcu_expedite_gp();
>>    for_each_online_cpu(cpu) {
>>        if (topology_is_primary_thread(cpu))
>>            continue;
>> @@ -2687,6 +2688,7 @@ int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
>>    }
>>    if (!ret)
>>        cpu_smt_control = ctrlval;
>> +    rcu_unexpedite_gp();
>>    cpu_maps_update_done();
>>    return ret;
>> }
>> @@ -2704,6 +2706,7 @@ int cpuhp_smt_enable(void)
>>    int cpu, ret = 0;
>> 
>>    cpu_maps_update_begin();
>> +    rcu_expedite_gp();
>>    cpu_smt_control = CPU_SMT_ENABLED;
>>    for_each_present_cpu(cpu) {
>>        /* Skip online CPUs and CPUs on offline nodes */
>> @@ -2717,6 +2720,7 @@ int cpuhp_smt_enable(void)
>>        /* See comment in cpuhp_smt_disable() */
>>        cpuhp_online_cpu_device(cpu);
>>    }
>> +    rcu_unexpedite_gp();
>>    cpu_maps_update_done();
>>    return ret;
>> }
>> diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
>> index fa6d30ce73d1..d6a63ee60bc0 100644
>> --- a/kernel/rcu/rcu.h
>> +++ b/kernel/rcu/rcu.h
>> @@ -521,8 +521,6 @@ do {                                    \
>> static inline bool rcu_gp_is_normal(void) { return true; }
>> static inline bool rcu_gp_is_expedited(void) { return false; }
>> static inline bool rcu_async_should_hurry(void) { return false; }
>> -static inline void rcu_expedite_gp(void) { }
>> -static inline void rcu_unexpedite_gp(void) { }
>> static inline void rcu_async_hurry(void) { }
>> static inline void rcu_async_relax(void) { }
>> static inline bool rcu_cpu_online(int cpu) { return true; }
>> @@ -530,8 +528,6 @@ static inline bool rcu_cpu_online(int cpu) { return true; }
>> bool rcu_gp_is_normal(void);     /* Internal RCU use. */
>> bool rcu_gp_is_expedited(void);  /* Internal RCU use. */
>> bool rcu_async_should_hurry(void);  /* Internal RCU use. */
>> -void rcu_expedite_gp(void);
>> -void rcu_unexpedite_gp(void);
>> void rcu_async_hurry(void);
>> void rcu_async_relax(void);
>> void rcupdate_announce_bootup_oddness(void);
>> --
>> 2.54.0
>> 

      parent reply	other threads:[~2026-11-12  9:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15  4:25 [PATCH v5 0/1] " Vishal Chourasia
2026-06-15  4:25 ` [PATCH v5 1/1] " Vishal Chourasia
2026-06-15 15:05   ` Paul E. McKenney
2026-06-16  6:09     ` Shrikanth Hegde
2026-07-21  4:31       ` Shrikanth Hegde
2026-07-29 14:53         ` Shrikanth Hegde
2026-11-12  7:32           ` Shrikanth Hegde
2026-11-12  9:20     ` Joel Fernandes [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=B6B9F4A3-954F-4FB5-B7E2-534CD785B18C@nvidia.com \
    --to=joelagnelf@nvidia.com \
    --cc=aboorvad@linux.ibm.com \
    --cc=boqun.feng@gmail.com \
    --cc=frederic@kernel.org \
    --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=tglx@linutronix.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®