add a comment about page size vs bpf ring buffer sizing am: 28f01bb027 am: cd4022ef2a am: 9045516e4a am: e5a0a70b78 am: bfb38761fd

Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2631549

Change-Id: Ia88378a72f6ed4ddd9ea392b435944eef019963d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp
index 231fe39..83f6a88 100644
--- a/libbpf_android/Loader.cpp
+++ b/libbpf_android/Loader.cpp
@@ -707,6 +707,9 @@
     if (type == BPF_MAP_TYPE_DEVMAP || type == BPF_MAP_TYPE_DEVMAP_HASH)
         desired_map_flags |= BPF_F_RDONLY_PROG;
 
+    // The .h file enforces that this is a power of two, and page size will
+    // also always be a power of two, so this logic is actually enough to
+    // force it to be a multiple of the page size, as required by the kernel.
     unsigned int desired_max_entries = mapDef.max_entries;
     if (type == BPF_MAP_TYPE_RINGBUF) {
         if (desired_max_entries < page_size) desired_max_entries = page_size;
@@ -849,6 +852,9 @@
             type = BPF_MAP_TYPE_HASH;
         }
 
+        // The .h file enforces that this is a power of two, and page size will
+        // also always be a power of two, so this logic is actually enough to
+        // force it to be a multiple of the page size, as required by the kernel.
         unsigned int max_entries = md[i].max_entries;
         if (type == BPF_MAP_TYPE_RINGBUF) {
             if (max_entries < page_size) max_entries = page_size;