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

Tejun Heo <[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]>
Hello,

On Fri, Aug 07, 2026 at 12:37:31PM -0700, Ziyang Men wrote:
> +__bpf_kfunc struct blkcg *bpf_get_root_blkcg(void)
> +__bpf_kfunc struct blkcg *bpf_get_blkcg(struct cgroup_subsys_state *css)
> +__bpf_kfunc void bpf_put_blkcg(struct blkcg *blkcg)
> +__bpf_kfunc void bpf_blkcg_flush_stats(struct blkcg *blkcg)

I wonder whether making the above deal with css's would make more sense so
that we don't end up with per-subsystem iterators. If casting to per-subsys
type is necessary, we can provide RCU protected cast kfucns.

> +__bpf_kfunc u64 bpf_blkg_iostat_bytes(struct blkcg_gq *blkg,
> +				      enum blkg_iostat_type rw)
> +__bpf_kfunc u64 bpf_blkg_iostat_ios(struct blkcg_gq *blkg,
> +				    enum blkg_iostat_type rw)
> +__bpf_kfunc u64 bpf_blkg_dev(struct blkcg_gq *blkg)

Ignoring 32bit split reads (do we really care for BPF accesses?), the above
can easily be done with BPF_CORE_READ(), right?

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.