On Sun, Mar 28, 2021 at 8:03 AM Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: [...] > > > > struct { > > __uint(type, BPF_MAP_TYPE_ARRAY); > > - __uint(max_entries, 4096); > > + __uint(max_entries, PAGE_SIZE); > > > so you can set map size at runtime before bpf_object__load (or > skeleton's load) with bpf_map__set_max_entries. That way you don't > have to do any assumptions. Just omit max_entries in BPF source code, > and always set it in userspace. Will it work for ringbuf_multi? If I just set max_entries for ringbuf1 and ringbuf2 that way, it gives me libbpf: map 'ringbuf_arr': failed to create inner map: -22 libbpf: map 'ringbuf_arr': failed to create: Invalid argument(-22) libbpf: failed to load object 'test_ringbuf_multi' libbpf: failed to load BPF skeleton 'test_ringbuf_multi': -22 test_ringbuf_multi:FAIL:skel_load skeleton load failed