Re: [PATCH bpf-next 2/5] bpf: Implement cgroup storage available to non-cgroup-attached bpf progs

Andrii Nakryiko
2022-10-18T23:12:33Z

On Tue, Oct 18, 2022 at 10:18 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Tue, Oct 18, 2022 at 10:08 AM <sdf@google.com> wrote:
> > > >
> > > > '#define BPF_MAP_TYPE_CGROUP_STORAGE BPF_MAP_TYPE_CGRP_LOCAL_STORAGE /*
> > > > depreciated by BPF_MAP_TYPE_CGRP_STORAGE */' in the uapi.
> > > >
> > > > The new cgroup storage uses a shorter name "cgrp", like
> > > > BPF_MAP_TYPE_CGRP_STORAGE and bpf_cgrp_storage_get()?
> >
> > > This might work and the naming convention will be similar to
> > > existing sk/inode/task storage.
> >
> > +1, CGRP_STORAGE sounds good!
>
> +1 from me as well.

it's totally bikeshedding zone :) but isn't CG_STORAGE just as
recognizable but easier to mentally read as well? Like SK for socket,
instead of SCKT

>
> Something like this ?
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 17f61338f8f8..13dcb2418847 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -922,7 +922,8 @@ enum bpf_map_type {
> BPF_MAP_TYPE_CPUMAP,
> BPF_MAP_TYPE_XSKMAP,
> BPF_MAP_TYPE_SOCKHASH,
> - BPF_MAP_TYPE_CGROUP_STORAGE,
> + BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED,
> + BPF_MAP_TYPE_CGROUP_STORAGE = BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED,
> BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
> BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE,
> BPF_MAP_TYPE_QUEUE,
> @@ -935,6 +936,7 @@ enum bpf_map_type {
> BPF_MAP_TYPE_TASK_STORAGE,
> BPF_MAP_TYPE_BLOOM_FILTER,
> BPF_MAP_TYPE_USER_RINGBUF,
> + BPF_MAP_TYPE_CGRP_STORAGE,
> };
>
> What are we going to do with BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE ?
> Probably should come up with a replacement as well?