Re: [PATCH v7 5/6] kernfs: Use RCU to access kernfs_node::parent.
From: Sebastian Andrzej Siewior
Date: Tue Feb 11 2025 - 02:57:29 EST
On 2025-02-10 08:41:00 [-0800], Yonghong Song wrote:
> > diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h
> > index 8bd1ebd7d6afd..a4f518ee5f4de 100644
> > --- a/tools/testing/selftests/bpf/progs/profiler.inc.h
> > +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
> > @@ -223,7 +223,7 @@ static INLINE void* read_full_cgroup_path(struct kernfs_node* cgroup_node,
> > if (bpf_cmp_likely(filepart_length, <=, MAX_PATH)) {
> > payload += filepart_length;
> > }
> > - cgroup_node = BPF_CORE_READ(cgroup_node, parent);
> > + cgroup_node = BPF_CORE_READ(cgroup_node, __parent);
> > }
> > return payload;
> > }
> > @@ -323,6 +324,7 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
> > cgroup_data->cgroup_full_length = payload_end_pos - payload;
> > payload = payload_end_pos;
> > }
> > + bpf_rcu_read_unlock();
>
> All programs calling this function populate_cgroup_info() is not sleepable program
> so the whole prog is protected by rcu and there is no need for above
> bpf_rcu_read_{lock,unlock}().
Understood. So just the rename then.
> > return (void*)payload;
> > }
Sebastian