* [PATCHv7 0/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug
@ 2025-11-19 9:55 Pingfan Liu
2025-11-19 9:55 ` [PATCHv7 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() Pingfan Liu
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Pingfan Liu @ 2025-11-19 9:55 UTC (permalink / raw)
Cc: Pingfan Liu, Waiman Long, Chen Ridong, Peter Zijlstra, Juri Lelli,
Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
Tejun Heo, Johannes Weiner, mkoutny, linux-kernel
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This series fixes a deadline bug triggered during CPU hot-removal, which
prevents the CPU from being removed. For details, please refer to the
commit log in [2/2]. In addition, [1/2] exposes the
cpuset_cpus_allowed_locked() interface for use by [2/2].
v6 -> v7:
Provide cpuset_cpus_allowed_locked() for !CONFIG_CPUSETS
v5 -> v6:
Introduce the cpuset_cpus_allowed_locked() variant (thanks to Waiman)
Use local_cpu_mask_dl to avoid cpumask allocation on the stack (thanks to Juri and Waiman)
v4 -> v5:
Move the housekeeping part into deadline.c (Thanks for Waiman's suggestion)
Use cpuset_cpus_allowed() instead of introducing new cpuset function (Thanks for Ridong's suggestion)
Pingfan Liu (2):
cgroup/cpuset: Introduce cpuset_cpus_allowed_locked()
sched/deadline: Walk up cpuset hierarchy to decide root domain when
hot-unplug
include/linux/cpuset.h | 9 ++++++-
kernel/cgroup/cpuset.c | 51 ++++++++++++++++++++++++++------------
kernel/sched/deadline.c | 54 ++++++++++++++++++++++++++++++++++++-----
3 files changed, 92 insertions(+), 22 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 21+ messages in thread* [PATCHv7 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() 2025-11-19 9:55 [PATCHv7 0/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Pingfan Liu @ 2025-11-19 9:55 ` Pingfan Liu 2025-11-19 20:51 ` Waiman Long 2025-11-20 1:12 ` Chen Ridong 2025-11-19 9:55 ` [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Pingfan Liu 2025-11-20 17:00 ` [PATCHv7 0/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Tejun Heo 2 siblings, 2 replies; 21+ messages in thread From: Pingfan Liu @ 2025-11-19 9:55 UTC (permalink / raw) To: cgroups Cc: Pingfan Liu, Waiman Long, Chen Ridong, Peter Zijlstra, Juri Lelli, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Tejun Heo, Johannes Weiner, mkoutny, linux-kernel cpuset_cpus_allowed() uses a reader lock that is sleepable under RT, which means it cannot be called inside raw_spin_lock_t context. Introduce a new cpuset_cpus_allowed_locked() helper that performs the same function as cpuset_cpus_allowed() except that the caller must have acquired the cpuset_mutex so that no further locking will be needed. Suggested-by: Waiman Long <longman@redhat.com> Signed-off-by: Pingfan Liu <piliu@redhat.com> Cc: Waiman Long <longman@redhat.com> Cc: Tejun Heo <tj@kernel.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: "Michal Koutný" <mkoutny@suse.com> Cc: linux-kernel@vger.kernel.org To: cgroups@vger.kernel.org --- include/linux/cpuset.h | 9 +++++++- kernel/cgroup/cpuset.c | 51 +++++++++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 2ddb256187b51..a98d3330385c2 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -74,6 +74,7 @@ extern void inc_dl_tasks_cs(struct task_struct *task); extern void dec_dl_tasks_cs(struct task_struct *task); extern void cpuset_lock(void); extern void cpuset_unlock(void); +extern void cpuset_cpus_allowed_locked(struct task_struct *p, struct cpumask *mask); extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); extern bool cpuset_cpus_allowed_fallback(struct task_struct *p); extern bool cpuset_cpu_is_isolated(int cpu); @@ -195,10 +196,16 @@ static inline void dec_dl_tasks_cs(struct task_struct *task) { } static inline void cpuset_lock(void) { } static inline void cpuset_unlock(void) { } +static inline void cpuset_cpus_allowed_locked(struct task_struct *p, + struct cpumask *mask) +{ + cpumask_copy(mask, task_cpu_possible_mask(p)); +} + static inline void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask) { - cpumask_copy(mask, task_cpu_possible_mask(p)); + cpuset_cpus_allowed_locked(p, mask); } static inline bool cpuset_cpus_allowed_fallback(struct task_struct *p) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 52468d2c178a3..7a179a1a2e30a 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -4116,24 +4116,13 @@ void __init cpuset_init_smp(void) BUG_ON(!cpuset_migrate_mm_wq); } -/** - * cpuset_cpus_allowed - return cpus_allowed mask from a tasks cpuset. - * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. - * @pmask: pointer to struct cpumask variable to receive cpus_allowed set. - * - * Description: Returns the cpumask_var_t cpus_allowed of the cpuset - * attached to the specified @tsk. Guaranteed to return some non-empty - * subset of cpu_active_mask, even if this means going outside the - * tasks cpuset, except when the task is in the top cpuset. - **/ - -void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) +/* + * Return cpus_allowed mask from a task's cpuset. + */ +static void __cpuset_cpus_allowed_locked(struct task_struct *tsk, struct cpumask *pmask) { - unsigned long flags; struct cpuset *cs; - spin_lock_irqsave(&callback_lock, flags); - cs = task_cs(tsk); if (cs != &top_cpuset) guarantee_active_cpus(tsk, pmask); @@ -4153,7 +4142,39 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) if (!cpumask_intersects(pmask, cpu_active_mask)) cpumask_copy(pmask, possible_mask); } +} +/** + * cpuset_cpus_allowed_locked - return cpus_allowed mask from a task's cpuset. + * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. + * @pmask: pointer to struct cpumask variable to receive cpus_allowed set. + * + * Similir to cpuset_cpus_allowed() except that the caller must have acquired + * cpuset_mutex. + */ +void cpuset_cpus_allowed_locked(struct task_struct *tsk, struct cpumask *pmask) +{ + lockdep_assert_held(&cpuset_mutex); + __cpuset_cpus_allowed_locked(tsk, pmask); +} + +/** + * cpuset_cpus_allowed - return cpus_allowed mask from a task's cpuset. + * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. + * @pmask: pointer to struct cpumask variable to receive cpus_allowed set. + * + * Description: Returns the cpumask_var_t cpus_allowed of the cpuset + * attached to the specified @tsk. Guaranteed to return some non-empty + * subset of cpu_active_mask, even if this means going outside the + * tasks cpuset, except when the task is in the top cpuset. + **/ + +void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) +{ + unsigned long flags; + + spin_lock_irqsave(&callback_lock, flags); + __cpuset_cpus_allowed_locked(tsk, pmask); spin_unlock_irqrestore(&callback_lock, flags); } -- 2.49.0 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCHv7 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() 2025-11-19 9:55 ` [PATCHv7 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() Pingfan Liu @ 2025-11-19 20:51 ` Waiman Long 2025-11-20 1:12 ` Chen Ridong 1 sibling, 0 replies; 21+ messages in thread From: Waiman Long @ 2025-11-19 20:51 UTC (permalink / raw) To: Pingfan Liu, cgroups Cc: Chen Ridong, Peter Zijlstra, Juri Lelli, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Tejun Heo, Johannes Weiner, mkoutny, linux-kernel On 11/19/25 4:55 AM, Pingfan Liu wrote: > cpuset_cpus_allowed() uses a reader lock that is sleepable under RT, > which means it cannot be called inside raw_spin_lock_t context. > > Introduce a new cpuset_cpus_allowed_locked() helper that performs the > same function as cpuset_cpus_allowed() except that the caller must have > acquired the cpuset_mutex so that no further locking will be needed. > > Suggested-by: Waiman Long <longman@redhat.com> > Signed-off-by: Pingfan Liu <piliu@redhat.com> > Cc: Waiman Long <longman@redhat.com> > Cc: Tejun Heo <tj@kernel.org> > Cc: Johannes Weiner <hannes@cmpxchg.org> > Cc: "Michal Koutný" <mkoutny@suse.com> > Cc: linux-kernel@vger.kernel.org > To: cgroups@vger.kernel.org > --- > include/linux/cpuset.h | 9 +++++++- > kernel/cgroup/cpuset.c | 51 +++++++++++++++++++++++++++++------------- > 2 files changed, 44 insertions(+), 16 deletions(-) > > diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h > index 2ddb256187b51..a98d3330385c2 100644 > --- a/include/linux/cpuset.h > +++ b/include/linux/cpuset.h > @@ -74,6 +74,7 @@ extern void inc_dl_tasks_cs(struct task_struct *task); > extern void dec_dl_tasks_cs(struct task_struct *task); > extern void cpuset_lock(void); > extern void cpuset_unlock(void); > +extern void cpuset_cpus_allowed_locked(struct task_struct *p, struct cpumask *mask); > extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); > extern bool cpuset_cpus_allowed_fallback(struct task_struct *p); > extern bool cpuset_cpu_is_isolated(int cpu); > @@ -195,10 +196,16 @@ static inline void dec_dl_tasks_cs(struct task_struct *task) { } > static inline void cpuset_lock(void) { } > static inline void cpuset_unlock(void) { } > > +static inline void cpuset_cpus_allowed_locked(struct task_struct *p, > + struct cpumask *mask) > +{ > + cpumask_copy(mask, task_cpu_possible_mask(p)); > +} > + > static inline void cpuset_cpus_allowed(struct task_struct *p, > struct cpumask *mask) > { > - cpumask_copy(mask, task_cpu_possible_mask(p)); > + cpuset_cpus_allowed_locked(p, mask); > } > > static inline bool cpuset_cpus_allowed_fallback(struct task_struct *p) > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 52468d2c178a3..7a179a1a2e30a 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -4116,24 +4116,13 @@ void __init cpuset_init_smp(void) > BUG_ON(!cpuset_migrate_mm_wq); > } > > -/** > - * cpuset_cpus_allowed - return cpus_allowed mask from a tasks cpuset. > - * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. > - * @pmask: pointer to struct cpumask variable to receive cpus_allowed set. > - * > - * Description: Returns the cpumask_var_t cpus_allowed of the cpuset > - * attached to the specified @tsk. Guaranteed to return some non-empty > - * subset of cpu_active_mask, even if this means going outside the > - * tasks cpuset, except when the task is in the top cpuset. > - **/ > - > -void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) > +/* > + * Return cpus_allowed mask from a task's cpuset. > + */ > +static void __cpuset_cpus_allowed_locked(struct task_struct *tsk, struct cpumask *pmask) > { > - unsigned long flags; > struct cpuset *cs; > > - spin_lock_irqsave(&callback_lock, flags); > - > cs = task_cs(tsk); > if (cs != &top_cpuset) > guarantee_active_cpus(tsk, pmask); > @@ -4153,7 +4142,39 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) > if (!cpumask_intersects(pmask, cpu_active_mask)) > cpumask_copy(pmask, possible_mask); > } > +} > > +/** > + * cpuset_cpus_allowed_locked - return cpus_allowed mask from a task's cpuset. > + * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. > + * @pmask: pointer to struct cpumask variable to receive cpus_allowed set. > + * > + * Similir to cpuset_cpus_allowed() except that the caller must have acquired > + * cpuset_mutex. > + */ > +void cpuset_cpus_allowed_locked(struct task_struct *tsk, struct cpumask *pmask) > +{ > + lockdep_assert_held(&cpuset_mutex); > + __cpuset_cpus_allowed_locked(tsk, pmask); > +} > + > +/** > + * cpuset_cpus_allowed - return cpus_allowed mask from a task's cpuset. > + * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. > + * @pmask: pointer to struct cpumask variable to receive cpus_allowed set. > + * > + * Description: Returns the cpumask_var_t cpus_allowed of the cpuset > + * attached to the specified @tsk. Guaranteed to return some non-empty > + * subset of cpu_active_mask, even if this means going outside the > + * tasks cpuset, except when the task is in the top cpuset. > + **/ > + > +void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) > +{ > + unsigned long flags; > + > + spin_lock_irqsave(&callback_lock, flags); > + __cpuset_cpus_allowed_locked(tsk, pmask); > spin_unlock_irqrestore(&callback_lock, flags); > } > Reviewed-by: Waiman Long <longman@redhat.com> ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv7 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() 2025-11-19 9:55 ` [PATCHv7 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() Pingfan Liu 2025-11-19 20:51 ` Waiman Long @ 2025-11-20 1:12 ` Chen Ridong 1 sibling, 0 replies; 21+ messages in thread From: Chen Ridong @ 2025-11-20 1:12 UTC (permalink / raw) To: Pingfan Liu, cgroups Cc: Waiman Long, Peter Zijlstra, Juri Lelli, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Tejun Heo, Johannes Weiner, mkoutny, linux-kernel On 2025/11/19 17:55, Pingfan Liu wrote: > cpuset_cpus_allowed() uses a reader lock that is sleepable under RT, > which means it cannot be called inside raw_spin_lock_t context. > > Introduce a new cpuset_cpus_allowed_locked() helper that performs the > same function as cpuset_cpus_allowed() except that the caller must have > acquired the cpuset_mutex so that no further locking will be needed. > > Suggested-by: Waiman Long <longman@redhat.com> > Signed-off-by: Pingfan Liu <piliu@redhat.com> > Cc: Waiman Long <longman@redhat.com> > Cc: Tejun Heo <tj@kernel.org> > Cc: Johannes Weiner <hannes@cmpxchg.org> > Cc: "Michal Koutný" <mkoutny@suse.com> > Cc: linux-kernel@vger.kernel.org > To: cgroups@vger.kernel.org > --- > include/linux/cpuset.h | 9 +++++++- > kernel/cgroup/cpuset.c | 51 +++++++++++++++++++++++++++++------------- > 2 files changed, 44 insertions(+), 16 deletions(-) > > diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h > index 2ddb256187b51..a98d3330385c2 100644 > --- a/include/linux/cpuset.h > +++ b/include/linux/cpuset.h > @@ -74,6 +74,7 @@ extern void inc_dl_tasks_cs(struct task_struct *task); > extern void dec_dl_tasks_cs(struct task_struct *task); > extern void cpuset_lock(void); > extern void cpuset_unlock(void); > +extern void cpuset_cpus_allowed_locked(struct task_struct *p, struct cpumask *mask); > extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); > extern bool cpuset_cpus_allowed_fallback(struct task_struct *p); > extern bool cpuset_cpu_is_isolated(int cpu); > @@ -195,10 +196,16 @@ static inline void dec_dl_tasks_cs(struct task_struct *task) { } > static inline void cpuset_lock(void) { } > static inline void cpuset_unlock(void) { } > > +static inline void cpuset_cpus_allowed_locked(struct task_struct *p, > + struct cpumask *mask) > +{ > + cpumask_copy(mask, task_cpu_possible_mask(p)); > +} > + > static inline void cpuset_cpus_allowed(struct task_struct *p, > struct cpumask *mask) > { > - cpumask_copy(mask, task_cpu_possible_mask(p)); > + cpuset_cpus_allowed_locked(p, mask); > } > > static inline bool cpuset_cpus_allowed_fallback(struct task_struct *p) > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 52468d2c178a3..7a179a1a2e30a 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -4116,24 +4116,13 @@ void __init cpuset_init_smp(void) > BUG_ON(!cpuset_migrate_mm_wq); > } > > -/** > - * cpuset_cpus_allowed - return cpus_allowed mask from a tasks cpuset. > - * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. > - * @pmask: pointer to struct cpumask variable to receive cpus_allowed set. > - * > - * Description: Returns the cpumask_var_t cpus_allowed of the cpuset > - * attached to the specified @tsk. Guaranteed to return some non-empty > - * subset of cpu_active_mask, even if this means going outside the > - * tasks cpuset, except when the task is in the top cpuset. > - **/ > - > -void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) > +/* > + * Return cpus_allowed mask from a task's cpuset. > + */ > +static void __cpuset_cpus_allowed_locked(struct task_struct *tsk, struct cpumask *pmask) > { > - unsigned long flags; > struct cpuset *cs; > > - spin_lock_irqsave(&callback_lock, flags); > - > cs = task_cs(tsk); > if (cs != &top_cpuset) > guarantee_active_cpus(tsk, pmask); > @@ -4153,7 +4142,39 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) > if (!cpumask_intersects(pmask, cpu_active_mask)) > cpumask_copy(pmask, possible_mask); > } > +} > > +/** > + * cpuset_cpus_allowed_locked - return cpus_allowed mask from a task's cpuset. > + * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. > + * @pmask: pointer to struct cpumask variable to receive cpus_allowed set. > + * > + * Similir to cpuset_cpus_allowed() except that the caller must have acquired > + * cpuset_mutex. > + */ > +void cpuset_cpus_allowed_locked(struct task_struct *tsk, struct cpumask *pmask) > +{ > + lockdep_assert_held(&cpuset_mutex); > + __cpuset_cpus_allowed_locked(tsk, pmask); > +} > + > +/** > + * cpuset_cpus_allowed - return cpus_allowed mask from a task's cpuset. > + * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. > + * @pmask: pointer to struct cpumask variable to receive cpus_allowed set. > + * > + * Description: Returns the cpumask_var_t cpus_allowed of the cpuset > + * attached to the specified @tsk. Guaranteed to return some non-empty > + * subset of cpu_active_mask, even if this means going outside the > + * tasks cpuset, except when the task is in the top cpuset. > + **/ > + > +void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) > +{ > + unsigned long flags; > + > + spin_lock_irqsave(&callback_lock, flags); > + __cpuset_cpus_allowed_locked(tsk, pmask); > spin_unlock_irqrestore(&callback_lock, flags); > } > LGTM Reviewed-by: Chen Ridong <chenridong@huawei.com> -- Best regards, Ridong ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug 2025-11-19 9:55 [PATCHv7 0/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Pingfan Liu 2025-11-19 9:55 ` [PATCHv7 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() Pingfan Liu @ 2025-11-19 9:55 ` Pingfan Liu 2025-11-21 13:05 ` Juri Lelli 2025-11-25 3:26 ` [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() Pingfan Liu 2025-11-20 17:00 ` [PATCHv7 0/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Tejun Heo 2 siblings, 2 replies; 21+ messages in thread From: Pingfan Liu @ 2025-11-19 9:55 UTC (permalink / raw) To: linux-kernel Cc: Pingfan Liu, Waiman Long, Chen Ridong, Peter Zijlstra, Juri Lelli, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Tejun Heo, Johannes Weiner, mkoutny *** Bug description *** When testing kexec-reboot on a 144 cpus machine with isolcpus=managed_irq,domain,1-71,73-143 in kernel command line, I encounter the following bug: [ 97.114759] psci: CPU142 killed (polled 0 ms) [ 97.333236] Failed to offline CPU143 - error=-16 [ 97.333246] ------------[ cut here ]------------ [ 97.342682] kernel BUG at kernel/cpu.c:1569! [ 97.347049] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP [...] In essence, the issue originates from the CPU hot-removal process, not limited to kexec. It can be reproduced by writing a SCHED_DEADLINE program that waits indefinitely on a semaphore, spawning multiple instances to ensure some run on CPU 72, and then offlining CPUs 1–143 one by one. When attempting this, CPU 143 failed to go offline. bash -c 'taskset -cp 0 $$ && for i in {1..143}; do echo 0 > /sys/devices/system/cpu/cpu$i/online 2>/dev/null; done' Tracking down this issue, I found that dl_bw_deactivate() returned -EBUSY, which caused sched_cpu_deactivate() to fail on the last CPU. But that is not the fact, and contributed by the following factors: When a CPU is inactive, cpu_rq()->rd is set to def_root_domain. For an blocked-state deadline task (in this case, "cppc_fie"), it was not migrated to CPU0, and its task_rq() information is stale. So its rq->rd points to def_root_domain instead of the one shared with CPU0. As a result, its bandwidth is wrongly accounted into a wrong root domain during domain rebuild. *** Issue *** The key point is that root_domain is only tracked through active rq->rd. To avoid using a global data structure to track all root_domains in the system, there should be a method to locate an active CPU within the corresponding root_domain. *** Solution *** To locate the active cpu, the following rules for deadline sub-system is useful -1.any cpu belongs to a unique root domain at a given time -2.DL bandwidth checker ensures that the root domain has active cpus. Now, let's examine the blocked-state task P. If P is attached to a cpuset that is a partition root, it is straightforward to find an active CPU. If P is attached to a cpuset that has changed from 'root' to 'member', the active CPUs are grouped into the parent root domain. Naturally, the CPUs' capacity and reserved DL bandwidth are taken into account in the ancestor root domain. (In practice, it may be unsafe to attach P to an arbitrary root domain, since that domain may lack sufficient DL bandwidth for P.) Again, it is straightforward to find an active CPU in the ancestor root domain. This patch groups CPUs into isolated and housekeeping sets. For the housekeeping group, it walks up the cpuset hierarchy to find active CPUs in P's root domain and retrieves the valid rd from cpu_rq(cpu)->rd. Signed-off-by: Pingfan Liu <piliu@redhat.com> Cc: Waiman Long <longman@redhat.com> Cc: Chen Ridong <chenridong@huaweicloud.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ben Segall <bsegall@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Valentin Schneider <vschneid@redhat.com> To: linux-kernel@vger.kernel.org --- kernel/sched/deadline.c | 54 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 7b7671060bf9e..194a341e85864 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2465,6 +2465,7 @@ static struct task_struct *pick_earliest_pushable_dl_task(struct rq *rq, int cpu return NULL; } +/* Access rule: must be called on local CPU with preemption disabled */ static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask_dl); static int find_later_rq(struct task_struct *task) @@ -2907,11 +2908,43 @@ void __init init_sched_dl_class(void) GFP_KERNEL, cpu_to_node(i)); } +/* + * This function always returns a non-empty bitmap in @cpus. This is because + * if a root domain has reserved bandwidth for DL tasks, the DL bandwidth + * check will prevent CPU hotplug from deactivating all CPUs in that domain. + */ +static void dl_get_task_effective_cpus(struct task_struct *p, struct cpumask *cpus) +{ + const struct cpumask *hk_msk; + + hk_msk = housekeeping_cpumask(HK_TYPE_DOMAIN); + if (housekeeping_enabled(HK_TYPE_DOMAIN)) { + if (!cpumask_intersects(p->cpus_ptr, hk_msk)) { + /* + * CPUs isolated by isolcpu="domain" always belong to + * def_root_domain. + */ + cpumask_andnot(cpus, cpu_active_mask, hk_msk); + return; + } + } + + /* + * If a root domain holds a DL task, it must have active CPUs. So + * active CPUs can always be found by walking up the task's cpuset + * hierarchy up to the partition root. + */ + cpuset_cpus_allowed_locked(p, cpus); +} + +/* The caller should hold cpuset_mutex */ void dl_add_task_root_domain(struct task_struct *p) { struct rq_flags rf; struct rq *rq; struct dl_bw *dl_b; + unsigned int cpu; + struct cpumask *msk = this_cpu_cpumask_var_ptr(local_cpu_mask_dl); raw_spin_lock_irqsave(&p->pi_lock, rf.flags); if (!dl_task(p) || dl_entity_is_special(&p->dl)) { @@ -2919,16 +2952,25 @@ void dl_add_task_root_domain(struct task_struct *p) return; } - rq = __task_rq_lock(p, &rf); - + /* + * Get an active rq, whose rq->rd traces the correct root + * domain. + * Ideally this would be under cpuset reader lock until rq->rd is + * fetched. However, sleepable locks cannot nest inside pi_lock, so we + * rely on the caller of dl_add_task_root_domain() holds 'cpuset_mutex' + * to guarantee the CPU stays in the cpuset. + */ + dl_get_task_effective_cpus(p, msk); + cpu = cpumask_first_and(cpu_active_mask, msk); + BUG_ON(cpu >= nr_cpu_ids); + rq = cpu_rq(cpu); dl_b = &rq->rd->dl_bw; - raw_spin_lock(&dl_b->lock); + /* End of fetching rd */ + raw_spin_lock(&dl_b->lock); __dl_add(dl_b, p->dl.dl_bw, cpumask_weight(rq->rd->span)); - raw_spin_unlock(&dl_b->lock); - - task_rq_unlock(rq, p, &rf); + raw_spin_unlock_irqrestore(&p->pi_lock, rf.flags); } void dl_clear_root_domain(struct root_domain *rd) -- 2.49.0 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug 2025-11-19 9:55 ` [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Pingfan Liu @ 2025-11-21 13:05 ` Juri Lelli 2025-11-24 1:45 ` Pingfan Liu 2025-11-25 3:26 ` [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() Pingfan Liu 1 sibling, 1 reply; 21+ messages in thread From: Juri Lelli @ 2025-11-21 13:05 UTC (permalink / raw) To: Pingfan Liu Cc: linux-kernel, Waiman Long, Chen Ridong, Peter Zijlstra, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Tejun Heo, Johannes Weiner, mkoutny Hi! On 19/11/25 17:55, Pingfan Liu wrote: ... > +/* Access rule: must be called on local CPU with preemption disabled */ > static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask_dl); ... > +/* The caller should hold cpuset_mutex */ Maybe we can add a lockdep explicit check? > void dl_add_task_root_domain(struct task_struct *p) > { > struct rq_flags rf; > struct rq *rq; > struct dl_bw *dl_b; > + unsigned int cpu; > + struct cpumask *msk = this_cpu_cpumask_var_ptr(local_cpu_mask_dl); Can this corrupt local_cpu_mask_dl? Without preemption being disabled, the following race can occur: 1. Thread calls dl_add_task_root_domain() on CPU 0 2. Gets pointer to CPU 0's local_cpu_mask_dl 3. Thread is preempted and migrated to CPU 1 4. Thread continues using CPU 0's local_cpu_mask_dl 5. Meanwhile, the scheduler on CPU 0 calls find_later_rq() which also uses local_cpu_mask_dl (with preemption properly disabled) 6. Both contexts now corrupt the same per-CPU buffer concurrently > > raw_spin_lock_irqsave(&p->pi_lock, rf.flags); It's safe to get the pointer after this point. > if (!dl_task(p) || dl_entity_is_special(&p->dl)) { > @@ -2919,16 +2952,25 @@ void dl_add_task_root_domain(struct task_struct *p) > return; > } > > - rq = __task_rq_lock(p, &rf); > - > + /* > + * Get an active rq, whose rq->rd traces the correct root > + * domain. > + * Ideally this would be under cpuset reader lock until rq->rd is > + * fetched. However, sleepable locks cannot nest inside pi_lock, so we > + * rely on the caller of dl_add_task_root_domain() holds 'cpuset_mutex' > + * to guarantee the CPU stays in the cpuset. > + */ > + dl_get_task_effective_cpus(p, msk); > + cpu = cpumask_first_and(cpu_active_mask, msk); > + BUG_ON(cpu >= nr_cpu_ids); > + rq = cpu_rq(cpu); > dl_b = &rq->rd->dl_bw; > - raw_spin_lock(&dl_b->lock); > + /* End of fetching rd */ Not sure we need this comment above. :) > + raw_spin_lock(&dl_b->lock); > __dl_add(dl_b, p->dl.dl_bw, cpumask_weight(rq->rd->span)); > - > raw_spin_unlock(&dl_b->lock); > - > - task_rq_unlock(rq, p, &rf); > + raw_spin_unlock_irqrestore(&p->pi_lock, rf.flags); > } Thanks, Juri ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug 2025-11-21 13:05 ` Juri Lelli @ 2025-11-24 1:45 ` Pingfan Liu 2025-11-24 2:24 ` Waiman Long 0 siblings, 1 reply; 21+ messages in thread From: Pingfan Liu @ 2025-11-24 1:45 UTC (permalink / raw) To: Juri Lelli Cc: linux-kernel, Waiman Long, Chen Ridong, Peter Zijlstra, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Tejun Heo, Johannes Weiner, mkoutny On Fri, Nov 21, 2025 at 02:05:31PM +0100, Juri Lelli wrote: > Hi! > > On 19/11/25 17:55, Pingfan Liu wrote: > > ... > > > +/* Access rule: must be called on local CPU with preemption disabled */ > > static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask_dl); > > ... > > > +/* The caller should hold cpuset_mutex */ > > Maybe we can add a lockdep explicit check? > Currently, all cpuset locks are encapsulated in kernel/cgroup/cpuset-internal.h. I'm not sure if it's appropriate to expose them. If exposing them is acceptable, cpuset_callback_lock_irq()/cpuset_callback_unlock_irq() would be preferable to cpuset_mutex assertion. @Waiman, @Ridong, could you kindly share your opinion? > > void dl_add_task_root_domain(struct task_struct *p) > > { > > struct rq_flags rf; > > struct rq *rq; > > struct dl_bw *dl_b; > > + unsigned int cpu; > > + struct cpumask *msk = this_cpu_cpumask_var_ptr(local_cpu_mask_dl); > > Can this corrupt local_cpu_mask_dl? > > Without preemption being disabled, the following race can occur: > > 1. Thread calls dl_add_task_root_domain() on CPU 0 > 2. Gets pointer to CPU 0's local_cpu_mask_dl > 3. Thread is preempted and migrated to CPU 1 > 4. Thread continues using CPU 0's local_cpu_mask_dl > 5. Meanwhile, the scheduler on CPU 0 calls find_later_rq() which also > uses local_cpu_mask_dl (with preemption properly disabled) > 6. Both contexts now corrupt the same per-CPU buffer concurrently > Oh, that is definitely an issue. Thanks for pointing it out. > > > > raw_spin_lock_irqsave(&p->pi_lock, rf.flags); > > It's safe to get the pointer after this point. > Yes. > > if (!dl_task(p) || dl_entity_is_special(&p->dl)) { > > @@ -2919,16 +2952,25 @@ void dl_add_task_root_domain(struct task_struct *p) > > return; > > } > > > > - rq = __task_rq_lock(p, &rf); > > - > > + /* > > + * Get an active rq, whose rq->rd traces the correct root > > + * domain. > > + * Ideally this would be under cpuset reader lock until rq->rd is > > + * fetched. However, sleepable locks cannot nest inside pi_lock, so we > > + * rely on the caller of dl_add_task_root_domain() holds 'cpuset_mutex' > > + * to guarantee the CPU stays in the cpuset. > > + */ > > + dl_get_task_effective_cpus(p, msk); > > + cpu = cpumask_first_and(cpu_active_mask, msk); > > + BUG_ON(cpu >= nr_cpu_ids); > > + rq = cpu_rq(cpu); > > dl_b = &rq->rd->dl_bw; > > - raw_spin_lock(&dl_b->lock); > > + /* End of fetching rd */ > > Not sure we need this comment above. :) > OK, I can remove them to keep the code neat. Thanks, Pingfan ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug 2025-11-24 1:45 ` Pingfan Liu @ 2025-11-24 2:24 ` Waiman Long 2025-11-24 3:56 ` Pingfan Liu 0 siblings, 1 reply; 21+ messages in thread From: Waiman Long @ 2025-11-24 2:24 UTC (permalink / raw) To: Pingfan Liu, Juri Lelli Cc: linux-kernel, Chen Ridong, Peter Zijlstra, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Tejun Heo, Johannes Weiner, mkoutny On 11/23/25 8:45 PM, Pingfan Liu wrote: > On Fri, Nov 21, 2025 at 02:05:31PM +0100, Juri Lelli wrote: >> Hi! >> >> On 19/11/25 17:55, Pingfan Liu wrote: >> >> ... >> >>> +/* Access rule: must be called on local CPU with preemption disabled */ >>> static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask_dl); >> ... >> >>> +/* The caller should hold cpuset_mutex */ >> Maybe we can add a lockdep explicit check? >> > Currently, all cpuset locks are encapsulated in > kernel/cgroup/cpuset-internal.h. I'm not sure if it's appropriate to > expose them. If exposing them is acceptable, > cpuset_callback_lock_irq()/cpuset_callback_unlock_irq() would be > preferable to cpuset_mutex assertion. > > @Waiman, @Ridong, could you kindly share your opinion? The cpuset_cpus_allowed_locked() already has a "lockdep_assert_held(&cpuset_mutex)" call to make sure that cpuset_mutex is held, or a warning will be printed by the debug kernel. So a check is there, it is just not in the deadline.c code. The dl_add_task_root_domain() is called indirectly from dl_rebuild_rd_accounting() in cpuset.c which does have an assertion on cpuset_mutex. There is an external visible cpuset_lock/unlock() to acquire and release the cpuset_mutex. However, there is no public API to assert that cpuset_mutex is held. There is another set of patch series that is going to add that in the near future. At this point, I don't think we need to have such an API yet. I will suggest adding comment to cpuset_cpus_allowed_locked() that it will warn if cpuset_mutex isn't held. Providing a cpuset_callback_{lock|unlock}_irq() helpers may not be helpful because we are back to the problem that callback_lock isn't a raw_spinlock_t. Cheers, Longman > >>> void dl_add_task_root_domain(struct task_struct *p) >>> { >>> struct rq_flags rf; >>> struct rq *rq; >>> struct dl_bw *dl_b; >>> + unsigned int cpu; >>> + struct cpumask *msk = this_cpu_cpumask_var_ptr(local_cpu_mask_dl); >> Can this corrupt local_cpu_mask_dl? >> >> Without preemption being disabled, the following race can occur: >> >> 1. Thread calls dl_add_task_root_domain() on CPU 0 >> 2. Gets pointer to CPU 0's local_cpu_mask_dl >> 3. Thread is preempted and migrated to CPU 1 >> 4. Thread continues using CPU 0's local_cpu_mask_dl >> 5. Meanwhile, the scheduler on CPU 0 calls find_later_rq() which also >> uses local_cpu_mask_dl (with preemption properly disabled) >> 6. Both contexts now corrupt the same per-CPU buffer concurrently >> > Oh, that is definitely an issue. Thanks for pointing it out. > >>> >>> raw_spin_lock_irqsave(&p->pi_lock, rf.flags); >> It's safe to get the pointer after this point. >> > Yes. >>> if (!dl_task(p) || dl_entity_is_special(&p->dl)) { >>> @@ -2919,16 +2952,25 @@ void dl_add_task_root_domain(struct task_struct *p) >>> return; >>> } >>> >>> - rq = __task_rq_lock(p, &rf); >>> - >>> + /* >>> + * Get an active rq, whose rq->rd traces the correct root >>> + * domain. >>> + * Ideally this would be under cpuset reader lock until rq->rd is >>> + * fetched. However, sleepable locks cannot nest inside pi_lock, so we >>> + * rely on the caller of dl_add_task_root_domain() holds 'cpuset_mutex' >>> + * to guarantee the CPU stays in the cpuset. >>> + */ >>> + dl_get_task_effective_cpus(p, msk); >>> + cpu = cpumask_first_and(cpu_active_mask, msk); >>> + BUG_ON(cpu >= nr_cpu_ids); >>> + rq = cpu_rq(cpu); >>> dl_b = &rq->rd->dl_bw; >>> - raw_spin_lock(&dl_b->lock); >>> + /* End of fetching rd */ >> Not sure we need this comment above. :) >> > OK, I can remove them to keep the code neat. > > > Thanks, > > Pingfan > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug 2025-11-24 2:24 ` Waiman Long @ 2025-11-24 3:56 ` Pingfan Liu 2025-11-24 4:24 ` Waiman Long 0 siblings, 1 reply; 21+ messages in thread From: Pingfan Liu @ 2025-11-24 3:56 UTC (permalink / raw) To: Waiman Long Cc: Juri Lelli, linux-kernel, Chen Ridong, Peter Zijlstra, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Tejun Heo, Johannes Weiner, mkoutny On Mon, Nov 24, 2025 at 10:24 AM Waiman Long <llong@redhat.com> wrote: > [...] > > Currently, all cpuset locks are encapsulated in > > kernel/cgroup/cpuset-internal.h. I'm not sure if it's appropriate to > > expose them. If exposing them is acceptable, > > cpuset_callback_lock_irq()/cpuset_callback_unlock_irq() would be > > preferable to cpuset_mutex assertion. > > > > @Waiman, @Ridong, could you kindly share your opinion? > > The cpuset_cpus_allowed_locked() already has a > "lockdep_assert_held(&cpuset_mutex)" call to make sure that > cpuset_mutex is held, or a warning will be printed by the debug kernel. > So a check is there, it is just not in the deadline.c code. The > dl_add_task_root_domain() is called indirectly from > dl_rebuild_rd_accounting() in cpuset.c which does have an assertion on > cpuset_mutex. > > There is an external visible cpuset_lock/unlock() to acquire and release > the cpuset_mutex. However, there is no public API to assert that > cpuset_mutex is held. There is another set of patch series that is going > to add that in the near future. At this point, I don't think we need to > have such an API yet. I will suggest adding comment > to cpuset_cpus_allowed_locked() that it will warn if cpuset_mutex isn't > held. > > Providing a cpuset_callback_{lock|unlock}_irq() helpers may not be > helpful because we are back to the problem that callback_lock isn't a > raw_spinlock_t. > I meant to put them outside the pi_lock, so it can reflect the original purpose of this section -- cpuset read access instead of write. But yes, I agree that at this point, there is no need to introduce a public API. > > > >>> void dl_add_task_root_domain(struct task_struct *p) > >>> { [...] > >>> + /* > >>> + * Get an active rq, whose rq->rd traces the correct root > >>> + * domain. > >>> + * Ideally this would be under cpuset reader lock until rq->rd is > >>> + * fetched. However, sleepable locks cannot nest inside pi_lock, so we > >>> + * rely on the caller of dl_add_task_root_domain() holds 'cpuset_mutex' > >>> + * to guarantee the CPU stays in the cpuset. > >>> + */ > >>> + dl_get_task_effective_cpus(p, msk); > >>> + cpu = cpumask_first_and(cpu_active_mask, msk); > >>> + BUG_ON(cpu >= nr_cpu_ids); > >>> + rq = cpu_rq(cpu); > >>> dl_b = &rq->rd->dl_bw; > >>> - raw_spin_lock(&dl_b->lock); > >>> + /* End of fetching rd */ > >> Not sure we need this comment above. :) > >> > > OK, I can remove them to keep the code neat. @Juri, sorry - I need to send out a fix that should be simple and focused: just the fix itself, without removing the comments. So I have not removed them. Anyway, they can remind us this is an atomic cpuset read context. Best Regards, Pingfan ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug 2025-11-24 3:56 ` Pingfan Liu @ 2025-11-24 4:24 ` Waiman Long 0 siblings, 0 replies; 21+ messages in thread From: Waiman Long @ 2025-11-24 4:24 UTC (permalink / raw) To: Pingfan Liu, Waiman Long Cc: Juri Lelli, linux-kernel, Chen Ridong, Peter Zijlstra, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Tejun Heo, Johannes Weiner, mkoutny On 11/23/25 10:56 PM, Pingfan Liu wrote: > On Mon, Nov 24, 2025 at 10:24 AM Waiman Long <llong@redhat.com> wrote: > [...] >>> Currently, all cpuset locks are encapsulated in >>> kernel/cgroup/cpuset-internal.h. I'm not sure if it's appropriate to >>> expose them. If exposing them is acceptable, >>> cpuset_callback_lock_irq()/cpuset_callback_unlock_irq() would be >>> preferable to cpuset_mutex assertion. >>> >>> @Waiman, @Ridong, could you kindly share your opinion? >> The cpuset_cpus_allowed_locked() already has a >> "lockdep_assert_held(&cpuset_mutex)" call to make sure that >> cpuset_mutex is held, or a warning will be printed by the debug kernel. >> So a check is there, it is just not in the deadline.c code. The >> dl_add_task_root_domain() is called indirectly from >> dl_rebuild_rd_accounting() in cpuset.c which does have an assertion on >> cpuset_mutex. >> >> There is an external visible cpuset_lock/unlock() to acquire and release >> the cpuset_mutex. However, there is no public API to assert that >> cpuset_mutex is held. There is another set of patch series that is going >> to add that in the near future. At this point, I don't think we need to >> have such an API yet. I will suggest adding comment >> to cpuset_cpus_allowed_locked() that it will warn if cpuset_mutex isn't >> held. >> >> Providing a cpuset_callback_{lock|unlock}_irq() helpers may not be >> helpful because we are back to the problem that callback_lock isn't a >> raw_spinlock_t. >> > I meant to put them outside the pi_lock, so it can reflect the > original purpose of this section -- cpuset read access instead of > write. But yes, I agree that at this point, there is no need to > introduce a public API. By putting it outside of the pi_lock, you may as well just call cpuset_cpus_allowed(). Cheers, Longman >>>>> void dl_add_task_root_domain(struct task_struct *p) >>>>> { > [...] > >>>>> + /* >>>>> + * Get an active rq, whose rq->rd traces the correct root >>>>> + * domain. >>>>> + * Ideally this would be under cpuset reader lock until rq->rd is >>>>> + * fetched. However, sleepable locks cannot nest inside pi_lock, so we >>>>> + * rely on the caller of dl_add_task_root_domain() holds 'cpuset_mutex' >>>>> + * to guarantee the CPU stays in the cpuset. >>>>> + */ >>>>> + dl_get_task_effective_cpus(p, msk); >>>>> + cpu = cpumask_first_and(cpu_active_mask, msk); >>>>> + BUG_ON(cpu >= nr_cpu_ids); >>>>> + rq = cpu_rq(cpu); >>>>> dl_b = &rq->rd->dl_bw; >>>>> - raw_spin_lock(&dl_b->lock); >>>>> + /* End of fetching rd */ >>>> Not sure we need this comment above. :) >>>> >>> OK, I can remove them to keep the code neat. > @Juri, sorry - I need to send out a fix that should be simple and > focused: just the fix itself, without removing the comments. So I have > not removed them. Anyway, they can remind us this is an atomic cpuset > read context. > > > Best Regards, > > Pingfan > ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() 2025-11-19 9:55 ` [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Pingfan Liu 2025-11-21 13:05 ` Juri Lelli @ 2025-11-25 3:26 ` Pingfan Liu 2025-11-25 3:26 ` [PATCHv2 1/2] sched/deadline: Remove unnecessary comment " Pingfan Liu ` (3 more replies) 1 sibling, 4 replies; 21+ messages in thread From: Pingfan Liu @ 2025-11-25 3:26 UTC (permalink / raw) To: cgroups, linux-kernel Cc: Pingfan Liu, Tejun Heo, Waiman Long, Chen Ridong, Peter Zijlstra, Juri Lelli, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider These two patches address the issue reported by Juri [1] (thanks!). The first removes an unnecessary comment, the second is the actual fix. @Tejun, while these could be squashed together, I kept them separate to maintain the one-patch-one-purpose rule. let me know if you'd like me to resend these in a different format, or feel free to adjust as needed. [1]: https://lore.kernel.org/lkml/aSBjm3mN_uIy64nz@jlelli-thinkpadt14gen4.remote.csb Pingfan Liu (2): sched/deadline: Remove unnecessary comment in dl_add_task_root_domain() sched/deadline: Fix potential race in dl_add_task_root_domain() kernel/sched/deadline.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) -- 2.49.0 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCHv2 1/2] sched/deadline: Remove unnecessary comment in dl_add_task_root_domain() 2025-11-25 3:26 ` [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() Pingfan Liu @ 2025-11-25 3:26 ` Pingfan Liu 2026-01-13 10:43 ` [tip: sched/urgent] " tip-bot2 for Pingfan Liu 2025-11-25 3:26 ` [PATCHv2 2/2] sched/deadline: Fix potential race " Pingfan Liu ` (2 subsequent siblings) 3 siblings, 1 reply; 21+ messages in thread From: Pingfan Liu @ 2025-11-25 3:26 UTC (permalink / raw) To: cgroups, linux-kernel Cc: Pingfan Liu, Tejun Heo, Waiman Long, Chen Ridong, Peter Zijlstra, Juri Lelli, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider The comments above dl_get_task_effective_cpus() and dl_add_task_root_domain() already explain how to fetch a valid root domain and protect against races. There's no need to repeat this inside dl_add_task_root_domain(). Remove the redundant comment to keep the code clean. No functional change. Signed-off-by: Pingfan Liu <piliu@redhat.com> Cc: Tejun Heo <tj@kernel.org> Cc: Waiman Long <longman@redhat.com> Cc: Chen Ridong <chenridong@huaweicloud.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ben Segall <bsegall@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Valentin Schneider <vschneid@redhat.com> To: cgroups@vger.kernel.org To: linux-kernel@vger.kernel.org --- kernel/sched/deadline.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 194a341e85864..0b6646259bcd7 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2952,20 +2952,11 @@ void dl_add_task_root_domain(struct task_struct *p) return; } - /* - * Get an active rq, whose rq->rd traces the correct root - * domain. - * Ideally this would be under cpuset reader lock until rq->rd is - * fetched. However, sleepable locks cannot nest inside pi_lock, so we - * rely on the caller of dl_add_task_root_domain() holds 'cpuset_mutex' - * to guarantee the CPU stays in the cpuset. - */ dl_get_task_effective_cpus(p, msk); cpu = cpumask_first_and(cpu_active_mask, msk); BUG_ON(cpu >= nr_cpu_ids); rq = cpu_rq(cpu); dl_b = &rq->rd->dl_bw; - /* End of fetching rd */ raw_spin_lock(&dl_b->lock); __dl_add(dl_b, p->dl.dl_bw, cpumask_weight(rq->rd->span)); -- 2.49.0 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [tip: sched/urgent] sched/deadline: Remove unnecessary comment in dl_add_task_root_domain() 2025-11-25 3:26 ` [PATCHv2 1/2] sched/deadline: Remove unnecessary comment " Pingfan Liu @ 2026-01-13 10:43 ` tip-bot2 for Pingfan Liu 0 siblings, 0 replies; 21+ messages in thread From: tip-bot2 for Pingfan Liu @ 2026-01-13 10:43 UTC (permalink / raw) To: linux-tip-commits Cc: Pingfan Liu, Peter Zijlstra (Intel), Juri Lelli, Waiman Long, x86, linux-kernel The following commit has been merged into the sched/urgent branch of tip: Commit-ID: 479972efc2e7c9e0b3743ac538b042fcd4f315d7 Gitweb: https://git.kernel.org/tip/479972efc2e7c9e0b3743ac538b042fcd4f315d7 Author: Pingfan Liu <piliu@redhat.com> AuthorDate: Tue, 25 Nov 2025 11:26:29 +08:00 Committer: Peter Zijlstra <peterz@infradead.org> CommitterDate: Tue, 13 Jan 2026 11:37:51 +01:00 sched/deadline: Remove unnecessary comment in dl_add_task_root_domain() The comments above dl_get_task_effective_cpus() and dl_add_task_root_domain() already explain how to fetch a valid root domain and protect against races. There's no need to repeat this inside dl_add_task_root_domain(). Remove the redundant comment to keep the code clean. No functional change. Signed-off-by: Pingfan Liu <piliu@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Juri Lelli <juri.lelli@redhat.com> Acked-by: Waiman Long <longman@redhat.com> Link: https://patch.msgid.link/20251125032630.8746-2-piliu@redhat.com --- kernel/sched/deadline.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 319439f..463ba50 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -3162,20 +3162,11 @@ void dl_add_task_root_domain(struct task_struct *p) return; } - /* - * Get an active rq, whose rq->rd traces the correct root - * domain. - * Ideally this would be under cpuset reader lock until rq->rd is - * fetched. However, sleepable locks cannot nest inside pi_lock, so we - * rely on the caller of dl_add_task_root_domain() holds 'cpuset_mutex' - * to guarantee the CPU stays in the cpuset. - */ dl_get_task_effective_cpus(p, msk); cpu = cpumask_first_and(cpu_active_mask, msk); BUG_ON(cpu >= nr_cpu_ids); rq = cpu_rq(cpu); dl_b = &rq->rd->dl_bw; - /* End of fetching rd */ raw_spin_lock(&dl_b->lock); __dl_add(dl_b, p->dl.dl_bw, cpumask_weight(rq->rd->span)); ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCHv2 2/2] sched/deadline: Fix potential race in dl_add_task_root_domain() 2025-11-25 3:26 ` [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() Pingfan Liu 2025-11-25 3:26 ` [PATCHv2 1/2] sched/deadline: Remove unnecessary comment " Pingfan Liu @ 2025-11-25 3:26 ` Pingfan Liu 2026-01-13 10:43 ` [tip: sched/urgent] " tip-bot2 for Pingfan Liu 2025-11-25 8:14 ` [PATCHv2 0/2] " Juri Lelli 2025-11-25 14:53 ` Waiman Long 3 siblings, 1 reply; 21+ messages in thread From: Pingfan Liu @ 2025-11-25 3:26 UTC (permalink / raw) To: cgroups, linux-kernel Cc: Pingfan Liu, Tejun Heo, Waiman Long, Chen Ridong, Peter Zijlstra, Juri Lelli, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider The access rule for local_cpu_mask_dl requires it to be called on the local CPU with preemption disabled. However, dl_add_task_root_domain() currently violates this rule. Without preemption disabled, the following race can occur: 1. ThreadA calls dl_add_task_root_domain() on CPU 0 2. Gets pointer to CPU 0's local_cpu_mask_dl 3. ThreadA is preempted and migrated to CPU 1 4. ThreadA continues using CPU 0's local_cpu_mask_dl 5. Meanwhile, the scheduler on CPU 0 calls find_later_rq() which also uses local_cpu_mask_dl (with preemption properly disabled) 6. Both contexts now corrupt the same per-CPU buffer concurrently Fix this by moving the local_cpu_mask_dl access to the preemption disabled section. Closes: https://lore.kernel.org/lkml/aSBjm3mN_uIy64nz@jlelli-thinkpadt14gen4.remote.csb Fixes: 318e18ed22e8 ("sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug") Reported-by: Juri Lelli <juri.lelli@redhat.com> Signed-off-by: Pingfan Liu <piliu@redhat.com> Cc: Tejun Heo <tj@kernel.org> Cc: Waiman Long <longman@redhat.com> Cc: Chen Ridong <chenridong@huaweicloud.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ben Segall <bsegall@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Valentin Schneider <vschneid@redhat.com> To: cgroups@vger.kernel.org To: linux-kernel@vger.kernel.org --- kernel/sched/deadline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 0b6646259bcd7..65c8539b468a2 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2944,7 +2944,7 @@ void dl_add_task_root_domain(struct task_struct *p) struct rq *rq; struct dl_bw *dl_b; unsigned int cpu; - struct cpumask *msk = this_cpu_cpumask_var_ptr(local_cpu_mask_dl); + struct cpumask *msk; raw_spin_lock_irqsave(&p->pi_lock, rf.flags); if (!dl_task(p) || dl_entity_is_special(&p->dl)) { @@ -2952,6 +2952,7 @@ void dl_add_task_root_domain(struct task_struct *p) return; } + msk = this_cpu_cpumask_var_ptr(local_cpu_mask_dl); dl_get_task_effective_cpus(p, msk); cpu = cpumask_first_and(cpu_active_mask, msk); BUG_ON(cpu >= nr_cpu_ids); -- 2.49.0 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [tip: sched/urgent] sched/deadline: Fix potential race in dl_add_task_root_domain() 2025-11-25 3:26 ` [PATCHv2 2/2] sched/deadline: Fix potential race " Pingfan Liu @ 2026-01-13 10:43 ` tip-bot2 for Pingfan Liu 0 siblings, 0 replies; 21+ messages in thread From: tip-bot2 for Pingfan Liu @ 2026-01-13 10:43 UTC (permalink / raw) To: linux-tip-commits Cc: Juri Lelli, Pingfan Liu, Peter Zijlstra (Intel), Waiman Long, x86, linux-kernel The following commit has been merged into the sched/urgent branch of tip: Commit-ID: 64e6fa76610ec970cfa8296ed057907a4b384ca5 Gitweb: https://git.kernel.org/tip/64e6fa76610ec970cfa8296ed057907a4b384ca5 Author: Pingfan Liu <piliu@redhat.com> AuthorDate: Tue, 25 Nov 2025 11:26:30 +08:00 Committer: Peter Zijlstra <peterz@infradead.org> CommitterDate: Tue, 13 Jan 2026 11:37:51 +01:00 sched/deadline: Fix potential race in dl_add_task_root_domain() The access rule for local_cpu_mask_dl requires it to be called on the local CPU with preemption disabled. However, dl_add_task_root_domain() currently violates this rule. Without preemption disabled, the following race can occur: 1. ThreadA calls dl_add_task_root_domain() on CPU 0 2. Gets pointer to CPU 0's local_cpu_mask_dl 3. ThreadA is preempted and migrated to CPU 1 4. ThreadA continues using CPU 0's local_cpu_mask_dl 5. Meanwhile, the scheduler on CPU 0 calls find_later_rq() which also uses local_cpu_mask_dl (with preemption properly disabled) 6. Both contexts now corrupt the same per-CPU buffer concurrently Fix this by moving the local_cpu_mask_dl access to the preemption disabled section. Closes: https://lore.kernel.org/lkml/aSBjm3mN_uIy64nz@jlelli-thinkpadt14gen4.remote.csb Fixes: 318e18ed22e8 ("sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug") Reported-by: Juri Lelli <juri.lelli@redhat.com> Signed-off-by: Pingfan Liu <piliu@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Juri Lelli <juri.lelli@redhat.com> Acked-by: Waiman Long <longman@redhat.com> Link: https://patch.msgid.link/20251125032630.8746-3-piliu@redhat.com --- kernel/sched/deadline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 463ba50..e3efc40 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -3154,7 +3154,7 @@ void dl_add_task_root_domain(struct task_struct *p) struct rq *rq; struct dl_bw *dl_b; unsigned int cpu; - struct cpumask *msk = this_cpu_cpumask_var_ptr(local_cpu_mask_dl); + struct cpumask *msk; raw_spin_lock_irqsave(&p->pi_lock, rf.flags); if (!dl_task(p) || dl_entity_is_special(&p->dl)) { @@ -3162,6 +3162,7 @@ void dl_add_task_root_domain(struct task_struct *p) return; } + msk = this_cpu_cpumask_var_ptr(local_cpu_mask_dl); dl_get_task_effective_cpus(p, msk); cpu = cpumask_first_and(cpu_active_mask, msk); BUG_ON(cpu >= nr_cpu_ids); ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() 2025-11-25 3:26 ` [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() Pingfan Liu 2025-11-25 3:26 ` [PATCHv2 1/2] sched/deadline: Remove unnecessary comment " Pingfan Liu 2025-11-25 3:26 ` [PATCHv2 2/2] sched/deadline: Fix potential race " Pingfan Liu @ 2025-11-25 8:14 ` Juri Lelli 2026-01-07 19:57 ` Waiman Long 2025-11-25 14:53 ` Waiman Long 3 siblings, 1 reply; 21+ messages in thread From: Juri Lelli @ 2025-11-25 8:14 UTC (permalink / raw) To: Pingfan Liu Cc: cgroups, linux-kernel, Tejun Heo, Waiman Long, Chen Ridong, Peter Zijlstra, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider Hi, On 25/11/25 11:26, Pingfan Liu wrote: > These two patches address the issue reported by Juri [1] (thanks!). > > The first removes an unnecessary comment, the second is the actual fix. > > @Tejun, while these could be squashed together, I kept them separate to > maintain the one-patch-one-purpose rule. let me know if you'd like me to > resend these in a different format, or feel free to adjust as needed. > > [1]: https://lore.kernel.org/lkml/aSBjm3mN_uIy64nz@jlelli-thinkpadt14gen4.remote.csb > > Pingfan Liu (2): > sched/deadline: Remove unnecessary comment in > dl_add_task_root_domain() > sched/deadline: Fix potential race in dl_add_task_root_domain() > > kernel/sched/deadline.c | 12 ++---------- > 1 file changed, 2 insertions(+), 10 deletions(-) For both Acked-by: Juri Lelli <juri.lelli@redhat.com> Thanks! Juri ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() 2025-11-25 8:14 ` [PATCHv2 0/2] " Juri Lelli @ 2026-01-07 19:57 ` Waiman Long 2026-01-08 11:42 ` Peter Zijlstra 0 siblings, 1 reply; 21+ messages in thread From: Waiman Long @ 2026-01-07 19:57 UTC (permalink / raw) To: Peter Zijlstra Cc: cgroups, linux-kernel, Tejun Heo, Chen Ridong, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Juri Lelli, Pingfan Liu On 11/25/25 3:14 AM, Juri Lelli wrote: > Hi, > > On 25/11/25 11:26, Pingfan Liu wrote: >> These two patches address the issue reported by Juri [1] (thanks!). >> >> The first removes an unnecessary comment, the second is the actual fix. >> >> @Tejun, while these could be squashed together, I kept them separate to >> maintain the one-patch-one-purpose rule. let me know if you'd like me to >> resend these in a different format, or feel free to adjust as needed. >> >> [1]: https://lore.kernel.org/lkml/aSBjm3mN_uIy64nz@jlelli-thinkpadt14gen4.remote.csb >> >> Pingfan Liu (2): >> sched/deadline: Remove unnecessary comment in >> dl_add_task_root_domain() >> sched/deadline: Fix potential race in dl_add_task_root_domain() >> >> kernel/sched/deadline.c | 12 ++---------- >> 1 file changed, 2 insertions(+), 10 deletions(-) > For both > > Acked-by: Juri Lelli <juri.lelli@redhat.com> Peter, Are these 2 patches eligible to be merged into the the scheduler branch of the tip tree? These are bug fixes to the deadline scheduler code. Cheers, Longman ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() 2026-01-07 19:57 ` Waiman Long @ 2026-01-08 11:42 ` Peter Zijlstra 2026-01-08 12:02 ` Pingfan Liu 0 siblings, 1 reply; 21+ messages in thread From: Peter Zijlstra @ 2026-01-08 11:42 UTC (permalink / raw) To: Waiman Long Cc: cgroups, linux-kernel, Tejun Heo, Chen Ridong, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Juri Lelli, Pingfan Liu On Wed, Jan 07, 2026 at 02:57:00PM -0500, Waiman Long wrote: > > On 11/25/25 3:14 AM, Juri Lelli wrote: > > Hi, > > > > On 25/11/25 11:26, Pingfan Liu wrote: > > > These two patches address the issue reported by Juri [1] (thanks!). > > > > > > The first removes an unnecessary comment, the second is the actual fix. > > > > > > @Tejun, while these could be squashed together, I kept them separate to > > > maintain the one-patch-one-purpose rule. let me know if you'd like me to > > > resend these in a different format, or feel free to adjust as needed. > > > > > > [1]: https://lore.kernel.org/lkml/aSBjm3mN_uIy64nz@jlelli-thinkpadt14gen4.remote.csb > > > > > > Pingfan Liu (2): > > > sched/deadline: Remove unnecessary comment in > > > dl_add_task_root_domain() > > > sched/deadline: Fix potential race in dl_add_task_root_domain() > > > > > > kernel/sched/deadline.c | 12 ++---------- > > > 1 file changed, 2 insertions(+), 10 deletions(-) > > For both > > > > Acked-by: Juri Lelli <juri.lelli@redhat.com> > > Peter, > > Are these 2 patches eligible to be merged into the the scheduler branch of > the tip tree? These are bug fixes to the deadline scheduler code. Thanks for the ping -- just to double check, I need to take the v2 patches, that are posted inside the v7 thread? I mean; I absolutely detest posting new series in the same thread as an older series and then you go and do non-linear versioning just to make it absolutely impossible to tell what's what. :-( ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() 2026-01-08 11:42 ` Peter Zijlstra @ 2026-01-08 12:02 ` Pingfan Liu 0 siblings, 0 replies; 21+ messages in thread From: Pingfan Liu @ 2026-01-08 12:02 UTC (permalink / raw) To: Peter Zijlstra Cc: Waiman Long, cgroups, linux-kernel, Tejun Heo, Chen Ridong, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Juri Lelli On Thu, Jan 8, 2026 at 7:42 PM Peter Zijlstra <peterz@infradead.org> wrote: > > On Wed, Jan 07, 2026 at 02:57:00PM -0500, Waiman Long wrote: > > > > On 11/25/25 3:14 AM, Juri Lelli wrote: > > > Hi, > > > > > > On 25/11/25 11:26, Pingfan Liu wrote: > > > > These two patches address the issue reported by Juri [1] (thanks!). > > > > > > > > The first removes an unnecessary comment, the second is the actual fix. > > > > > > > > @Tejun, while these could be squashed together, I kept them separate to > > > > maintain the one-patch-one-purpose rule. let me know if you'd like me to > > > > resend these in a different format, or feel free to adjust as needed. > > > > > > > > [1]: https://lore.kernel.org/lkml/aSBjm3mN_uIy64nz@jlelli-thinkpadt14gen4.remote.csb > > > > > > > > Pingfan Liu (2): > > > > sched/deadline: Remove unnecessary comment in > > > > dl_add_task_root_domain() > > > > sched/deadline: Fix potential race in dl_add_task_root_domain() > > > > > > > > kernel/sched/deadline.c | 12 ++---------- > > > > 1 file changed, 2 insertions(+), 10 deletions(-) > > > For both > > > > > > Acked-by: Juri Lelli <juri.lelli@redhat.com> > > > > Peter, > > > > Are these 2 patches eligible to be merged into the the scheduler branch of > > the tip tree? These are bug fixes to the deadline scheduler code. > > Thanks for the ping -- just to double check, I need to take the v2 > patches, that are posted inside the v7 thread? > Sorry for the confusion. The two fixes in v2 are actually intended to address the issue in patch [2/2] of v7. > I mean; I absolutely detest posting new series in the same thread as an > older series and then you go and do non-linear versioning just to make > it absolutely impossible to tell what's what. :-( > I will use reference format in future. Again, sorry for the confusion. Best Regards, Pingfan ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() 2025-11-25 3:26 ` [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() Pingfan Liu ` (2 preceding siblings ...) 2025-11-25 8:14 ` [PATCHv2 0/2] " Juri Lelli @ 2025-11-25 14:53 ` Waiman Long 3 siblings, 0 replies; 21+ messages in thread From: Waiman Long @ 2025-11-25 14:53 UTC (permalink / raw) To: Pingfan Liu, cgroups, linux-kernel Cc: Tejun Heo, Chen Ridong, Peter Zijlstra, Juri Lelli, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider On 11/24/25 10:26 PM, Pingfan Liu wrote: > These two patches address the issue reported by Juri [1] (thanks!). > > The first removes an unnecessary comment, the second is the actual fix. > > @Tejun, while these could be squashed together, I kept them separate to > maintain the one-patch-one-purpose rule. let me know if you'd like me to > resend these in a different format, or feel free to adjust as needed. > > [1]: https://lore.kernel.org/lkml/aSBjm3mN_uIy64nz@jlelli-thinkpadt14gen4.remote.csb > > Pingfan Liu (2): > sched/deadline: Remove unnecessary comment in > dl_add_task_root_domain() > sched/deadline: Fix potential race in dl_add_task_root_domain() > > kernel/sched/deadline.c | 12 ++---------- > 1 file changed, 2 insertions(+), 10 deletions(-) > For the patch series, Acked-by: Waiman Long <longman@redhat.com> ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv7 0/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug 2025-11-19 9:55 [PATCHv7 0/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Pingfan Liu 2025-11-19 9:55 ` [PATCHv7 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() Pingfan Liu 2025-11-19 9:55 ` [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Pingfan Liu @ 2025-11-20 17:00 ` Tejun Heo 2 siblings, 0 replies; 21+ messages in thread From: Tejun Heo @ 2025-11-20 17:00 UTC (permalink / raw) To: Pingfan Liu Cc: Waiman Long, Chen Ridong, Peter Zijlstra, Juri Lelli, Pierre Gondois, Ingo Molnar, Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider, Johannes Weiner, mkoutny, linux-kernel, cgroups On Wed, Nov 19, 2025 at 05:55:23PM +0800, Pingfan Liu wrote: > Pingfan Liu (2): > cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() > sched/deadline: Walk up cpuset hierarchy to decide root domain when > hot-unplug Applied 1-2 to cgroup/for-6.19. Thanks. -- tejun ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2026-01-13 10:43 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-19 9:55 [PATCHv7 0/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Pingfan Liu 2025-11-19 9:55 ` [PATCHv7 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() Pingfan Liu 2025-11-19 20:51 ` Waiman Long 2025-11-20 1:12 ` Chen Ridong 2025-11-19 9:55 ` [PATCHv7 2/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Pingfan Liu 2025-11-21 13:05 ` Juri Lelli 2025-11-24 1:45 ` Pingfan Liu 2025-11-24 2:24 ` Waiman Long 2025-11-24 3:56 ` Pingfan Liu 2025-11-24 4:24 ` Waiman Long 2025-11-25 3:26 ` [PATCHv2 0/2] sched/deadline: Fix potential race in dl_add_task_root_domain() Pingfan Liu 2025-11-25 3:26 ` [PATCHv2 1/2] sched/deadline: Remove unnecessary comment " Pingfan Liu 2026-01-13 10:43 ` [tip: sched/urgent] " tip-bot2 for Pingfan Liu 2025-11-25 3:26 ` [PATCHv2 2/2] sched/deadline: Fix potential race " Pingfan Liu 2026-01-13 10:43 ` [tip: sched/urgent] " tip-bot2 for Pingfan Liu 2025-11-25 8:14 ` [PATCHv2 0/2] " Juri Lelli 2026-01-07 19:57 ` Waiman Long 2026-01-08 11:42 ` Peter Zijlstra 2026-01-08 12:02 ` Pingfan Liu 2025-11-25 14:53 ` Waiman Long 2025-11-20 17:00 ` [PATCHv7 0/2] sched/deadline: Walk up cpuset hierarchy to decide root domain when hot-unplug Tejun Heo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox