Re: [tip:sched/core] [sched/fair] c9d93a73ce: WARNING:suspicious_RCU_usage

"Chen, Yu C" <[email protected]> Mon, 25 May 2026 09:53:22 +0800
Newsgroups dev.linux.lists.oe-lkp,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 5/23/2026 9:27 PM, kernel test robot wrote:

> 
> [  102.159951][   T23]
> [  102.160730][   T23] =============================
> [  102.162072][   T23] WARNING: suspicious RCU usage
> [  102.163398][   T23] 7.1.0-rc2-00011-gc9d93a73ce87 #1 Not tainted
> [  102.165064][   T23] -----------------------------
> [  102.167687][   T23] kernel/sched/fair.c:12793 suspicious rcu_dereference_check() usage!
> [  102.169994][   T23]

sched_cpu_deactivate() does not hold RCU read lock, nor are 
preemption/IRQs/BH disabled,
how about this:
  static void set_cpu_sd_state_busy(int cpu)
  {
         struct sched_domain *sd;
-       sd = rcu_dereference_all(per_cpu(sd_llc, cpu));
+       sd = rcu_dereference_all_check(per_cpu(sd_llc, cpu),
+                                      lockdep_is_cpus_held());

         /*
          * sd->nohz_idle only pairs with nr_busy_cpus on sd->shared; if 
this
@@ -12815,7 +12817,8 @@ void nohz_balance_exit_idle(struct rq *rq)
  static void set_cpu_sd_state_idle(int cpu)
  {
         struct sched_domain *sd;
-       sd = rcu_dereference_all(per_cpu(sd_llc, cpu));
+       sd = rcu_dereference_all_check(per_cpu(sd_llc, cpu),
+                                      lockdep_is_cpus_held());

         /* See set_cpu_sd_state_busy(): nohz_idle is only used with 
sd->shared. */
         if (!sd || !sd->shared || sd->nohz_idle)