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>
(cherry picked from https://android-review.googlesource.com/q/commit:8a117a374bd71dc21a42f5a4bdbe3324ca5357d8)
Merged-In: I9fcb1f9dc2e86038a7f1a486f4efbc28dba38ca0
Change-Id: I9fcb1f9dc2e86038a7f1a486f4efbc28dba38ca0
1 file changed
tree: d59d7eb5666ece4decde22a500698d914e8ffa43
  1. bpfloader/
  2. libbpf_android/
  3. progs/
  4. Android.bp
  5. NOTICE
  6. OWNERS
  7. OWNERS_bpf
  8. PREUPLOAD.cfg
  9. TEST_MAPPING