Re: [PATCH v4 1/5] sched/debug: Protect lockless rq->rd access in print_dl_rq()
From: K Prateek Nayak
Date: Mon Aug 10 2026 - 02:55:34 EST
Hello Aaron,
On 8/10/2026 7:28 AM, Aaron Tomlin wrote:
> @@ -1089,9 +1090,14 @@ void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq)
> SEQ_printf(m, " .%-30s: %lu\n", #x, (unsigned long)(dl_rq->x))
>
> PU(dl_nr_running);
> - dl_bw = &cpu_rq(cpu)->rd->dl_bw;
> - SEQ_printf(m, " .%-30s: %lld\n", "dl_bw->bw", dl_bw->bw);
> - SEQ_printf(m, " .%-30s: %lld\n", "dl_bw->total_bw", dl_bw->total_bw);
> + rcu_read_lock();
> + rd = READ_ONCE(cpu_rq(cpu)->rd);
nit. Why not rcu_dereference_all() here to keep symmetry with the
update side that now uses rcu_assign_pointer()?
> + if (rd) {
I don't think rq->rd can ever be NULL after the scheduler has
initialized.
> + dl_bw = &rd->dl_bw;
> + SEQ_printf(m, " .%-30s: %lld\n", "dl_bw->bw", dl_bw->bw);
> + SEQ_printf(m, " .%-30s: %lld\n", "dl_bw->total_bw", dl_bw->total_bw);
> + }
> + rcu_read_unlock();
>
> #undef PU
> }
--
Thanks and Regards,
Prateek