ANDROID: binder: show high watermark of alloc->pages.
authorMartijn Coenen <maco@android.com>
Mon, 13 Nov 2017 09:06:56 +0000 (10:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2017 15:33:03 +0000 (16:33 +0100)
Show the high watermark of the index into the alloc->pages
array, to facilitate sizing the buffer on a per-process
basis.

Signed-off-by: Martijn Coenen <maco@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder_alloc.c
drivers/android/binder_alloc.h

index 6f6f745605afc44861c22c29b55f8a74f42f3dd6..0dba2308125cbf2e103be08830ff9c1694485bce 100644 (file)
@@ -281,6 +281,9 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate,
                        goto err_vm_insert_page_failed;
                }
 
+               if (index + 1 > alloc->pages_high)
+                       alloc->pages_high = index + 1;
+
                trace_binder_alloc_page_end(alloc, index);
                /* vm_insert_page does not seem to increment the refcount */
        }
@@ -853,6 +856,7 @@ void binder_alloc_print_pages(struct seq_file *m,
        }
        mutex_unlock(&alloc->mutex);
        seq_printf(m, "  pages: %d:%d:%d\n", active, lru, free);
+       seq_printf(m, "  pages high watermark: %zu\n", alloc->pages_high);
 }
 
 /**
index 2dd33b6df1044e64b785a6193bc30b84ddf9d1c5..0b145307f1fd1cfdc76fd03c819bb3c533c28414 100644 (file)
@@ -92,6 +92,7 @@ struct binder_lru_page {
  * @pages:              array of binder_lru_page
  * @buffer_size:        size of address space specified via mmap
  * @pid:                pid for associated binder_proc (invariant after init)
+ * @pages_high:         high watermark of offset in @pages
  *
  * Bookkeeping structure for per-proc address space management for binder
  * buffers. It is normally initialized during binder_init() and binder_mmap()
@@ -112,6 +113,7 @@ struct binder_alloc {
        size_t buffer_size;
        uint32_t buffer_free;
        int pid;
+       size_t pages_high;
 };
 
 #ifdef CONFIG_ANDROID_BINDER_IPC_SELFTEST