Re: [PATCH] sched/topology: Add a cpus_read_lock to partition_sched_domains()
From: Sebastian Andrzej Siewior
Date: Thu Aug 13 2026 - 03:03:15 EST
On 2026-08-12 20:54:49 [+0800], Chen, Yu C wrote:
> Hi Sebastian,
Hi,
> > --- a/kernel/sched/topology.c
> > +++ b/kernel/sched/topology.c
> > @@ -3498,6 +3498,7 @@ static void partition_sched_domains_locked(int ndoms_new, cpumask_var_t doms_new
> > void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
> > struct sched_domain_attr *dattr_new)
> > {
> > + guard(cpus_read_lock)();
> > sched_domains_mutex_lock();
> > partition_sched_domains_locked(ndoms_new, doms_new, dattr_new);
> > sched_domains_mutex_unlock();
>
> Thanks for taking a look at this issue. I found that there is a comment
> around
> partition_sched_domains() says: "Call with hotplug lock held"
> Not sure if the caller of partition_sched_domains() rather than
> partition_sched_domains()
> should grab the cpuhotplug lock? I guess the issue is triggered when
How did I miss that part?
> CONFIG_CPUSETS=n, in this case rebuild_sched_domains() will not grab
> cpuhotplug lock, should we add guard(cpus_read_lock) in
> rebuild_sched_domains()
> instead?
Let me look…
> thanks,
> Chenyu
Sebastian