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

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

On Mon, Aug 10, 2026 at 05:17:26PM -0700, JP Kobryn wrote:
...
> The get/put kfuncs above use KF_ACQUIRE/RELEASE so the verifier can
> reject memcg access after the put. Replacing them with a generic API
> would call for tracking a new lifetime relationship between the css and
> memcg (or other derived) pointer.

So, if you need css -> memcg casting, I think that can just be RCU
protected. In fact, even for the iteration and access, RCU protection
probably makes more sense then KF_ACQUIRE/RELEASE. It's simpler and less
overhead especially given that most bpf progs that people care about are
non-sleepable and already in RCU critical section anyway.

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.