Re: [PATCH v2 1/2] block: add BPF kfuncs to read blkcg io.stat

Ziyang Men <[email protected]>
Newsgroups org.kernel.vger.cgroups,org.kernel.vger.bpf,org.kernel.vger.linux-block,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
Hi Tejun,

On Wed, Aug 19, 2026 at 12:51:57PM -1000, Tejun Heo wrote:
>Hello,
>
>On Wed, Aug 19, 2026 at 03:20:17PM -0700, Ziyang Men wrote:
>> Yes the css_rstat_flush() is exposed but currently it is marked as SLEEPABLE, so
>> it doesn't accept a RCU_PROTECTED css we proposed. This is not a problem for cpu
>> ones since &cgrp->self is a trusted pointer.
>
>Yeah, bummer, so we get ref on cgroups but the subsys pointers are RCU, so
>that means those refs are only RCU protected. I guess we can't avoid a kfunc
>to get acquire a subsys css from cgroup. I wish css_rstat_flush() didn't
>schedule but it does need that cond_resched().

Yeah that would be a pity. I will add kfuncs bpf_cgroup_css() and
bpf_css_release() to handle the reference for the css.

The bpf_blkcg_flush_stats() will be removed as well.

Thanks,
Ziyang

>
>Thanks.
>
>-- 
>tejun
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.