Re: [PATCH bpf-next v2 3/6] libbpf: Support new cgroup local storage

Yonghong Song
2022-10-22T00:33:25Z

On 10/21/22 4:10 PM, Andrii Nakryiko wrote:
> On Thu, Oct 20, 2022 at 3:13 PM Yonghong Song <yhs@fb.com> wrote:
>>
>> Add support for new cgroup local storage.
>>
>> Signed-off-by: Yonghong Song <yhs@fb.com>
>> ---
>
>
> LGTM, but I do think that BPF_MAP_TYPE_CG_STORAGE and "cg_storage" is
> easier to read and talk about. But that's minor.

I searched kernel/cgroup/* and kernel/bpf/cgroup.c and
include/linux/cgroup*.h. The 'cgrp' for abbreviation of 'cgroup' is much
more than
'cg' for 'cgroup' unless 'cg' appears in like 'memcg' or 'rdmacg'. So I
would just use 'cgrp' for now.

>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
>
>> tools/lib/bpf/libbpf.c | 1 +
>> tools/lib/bpf/libbpf_probes.c | 1 +
>> 2 files changed, 2 insertions(+)
>>
>> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
>> index 027fd9565c16..5d7819edf074 100644
>> --- a/tools/lib/bpf/libbpf.c
>> +++ b/tools/lib/bpf/libbpf.c
>> @@ -164,6 +164,7 @@ static const char * const map_type_name[] = {
>> [BPF_MAP_TYPE_TASK_STORAGE] = "task_storage",
>> [BPF_MAP_TYPE_BLOOM_FILTER] = "bloom_filter",
>> [BPF_MAP_TYPE_USER_RINGBUF] = "user_ringbuf",
>> + [BPF_MAP_TYPE_CGRP_STORAGE] = "cgrp_storage",
>> };
>>
>> static const char * const prog_type_name[] = {
>> diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
>> index f3a8e8e74eb8..bdb83d467f9a 100644
>> --- a/tools/lib/bpf/libbpf_probes.c
>> +++ b/tools/lib/bpf/libbpf_probes.c
>> @@ -221,6 +221,7 @@ static int probe_map_create(enum bpf_map_type map_type)
>> case BPF_MAP_TYPE_SK_STORAGE:
>> case BPF_MAP_TYPE_INODE_STORAGE:
>> case BPF_MAP_TYPE_TASK_STORAGE:
>> + case BPF_MAP_TYPE_CGRP_STORAGE:
>> btf_key_type_id = 1;
>> btf_value_type_id = 3;
>> value_size = 8;
>> --
>> 2.30.2
>>