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

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

On Wed, Aug 19, 2026 at 10:43:51AM -1000, Tejun Heo wrote:
>Hello,
>
>On Tue, Aug 18, 2026 at 04:01:58PM -0700, Ziyang Men wrote:
>> On Tue, Aug 18, 2026 at 12:42:54PM -1000, Tejun Heo wrote:
>> > On Tue, Aug 18, 2026 at 03:31:29PM -0700, Ziyang Men wrote:
>> > > Ok I will add the casts bpf_get_blkcg() and bpf_put_blkcg(), and remove the
>> > > check of css->ss in above functoins.
>> >
>> > RCU_PROTECTED is probably better than get/put().
>>
>> Yes we can make the blkcg* RCU_PROTECTED but then the bpf_blkcg_flush_stats()
>> needs to take the @cgroup* since it is SLEEPABLE. Does this work for you?
>
>Do we really need that function? css_rstat_flush() is already exposed and
>css can already be obtained, right? blkcg_fill_root_iostat() is just
>accessing system-wide bdev stats, which you probably don't need to begin
>with or if necessary just access through bdevs.

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. 

Best,
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.