Re: [PATCH v2 1/2] cgroup: add BPF kfuncs to read a cpu cgroup's stats

From: Tejun Heo

Date: Wed Aug 19 2026 - 16:56:04 EST


Hello,

On Tue, Aug 18, 2026 at 04:59:17PM -0700, Ziyang Men wrote:
> > > The bpf_cgroup_base_stat() takes an rstat spinlock_t, which can sleep on
> > > PREEMPT_RT.
> >
> > Is this actually required? This doesn't really make sense to me. Shouldn't
> > what SLEEPABLE mean change on RT kernels instead?
>
> Oh sorry, I didn't notice that.
>
> I might be wrong: this function calls the cputime_adjust(), which in turn
> acquires raw_spin_lock_irqsave(), so there would be NMI deadlock in the
> perf_event program. The __css_rstat_lock() take the spin_lock_irq() as well. So
> maybe a SLEEPABLE tag is still necessary?

I think this is for BPF folks to answer. I don't think SLEEPABLE is needed
because of RT but yeah it wouldn't be safe to be called from nmi context.

Thanks.

--
tejun