bpfLoader: automatically bump ringbuffer size up to page size

A 4kB BPF_MAP_TYPE_RINGBUF does not work on 16kB page size kernel,
as an eBPF ring buffer size *must* be a multiple of the page size.

However, it is inefficient to force a 16kB RINGBUF on kernels
with only a 4kB page size.

It wastes 12kB of mlock'ed memory per ring buffer,
which isn't much, but - as we add more ringbuffers - it'll add up...

The userspace ring buffer code doesn't actually mind the
automatic increase in size, as it retrieves the actual
size from the map fd (ie. from the kernel) during init
and thus adjusts automatically.

Test: TreeHugger
Bug: 279819914
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9fcb1f9dc2e86038a7f1a486f4efbc28dba38ca0
1 file changed
tree: 560d2414cd343efe02e55694a7a3133bc5e651a6
  1. bpfloader/
  2. libbpf_android/
  3. progs/
  4. Android.bp
  5. NOTICE
  6. OWNERS
  7. OWNERS_bpf
  8. PREUPLOAD.cfg
  9. TEST_MAPPING