Skip to content

Commit d61c22c

Browse files
Martijn Coenenpundiramit
authored andcommitted
ANDROID: binder: show high watermark of alloc->pages.
Show the high watermark of the index into the alloc->pages array, to facilitate sizing the buffer on a per-process basis. Change-Id: I2b40cd16628e0ee45216c51dc9b3c5b0c862032e Signed-off-by: Martijn Coenen <maco@android.com>
1 parent 6dce05a commit d61c22c

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/android/binder_alloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate,
282282
goto err_vm_insert_page_failed;
283283
}
284284

285+
if (index + 1 > alloc->pages_high)
286+
alloc->pages_high = index + 1;
287+
285288
trace_binder_alloc_page_end(alloc, index);
286289
/* vm_insert_page does not seem to increment the refcount */
287290
}
@@ -855,6 +858,7 @@ void binder_alloc_print_pages(struct seq_file *m,
855858
}
856859
mutex_unlock(&alloc->mutex);
857860
seq_printf(m, " pages: %d:%d:%d\n", active, lru, free);
861+
seq_printf(m, " pages high watermark: %zu\n", alloc->pages_high);
858862
}
859863

860864
/**

drivers/android/binder_alloc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ struct binder_lru_page {
9292
* @pages: array of binder_lru_page
9393
* @buffer_size: size of address space specified via mmap
9494
* @pid: pid for associated binder_proc (invariant after init)
95+
* @pages_high: high watermark of offset in @pages
9596
*
9697
* Bookkeeping structure for per-proc address space management for binder
9798
* buffers. It is normally initialized during binder_init() and binder_mmap()
@@ -112,6 +113,7 @@ struct binder_alloc {
112113
size_t buffer_size;
113114
uint32_t buffer_free;
114115
int pid;
116+
size_t pages_high;
115117
};
116118

117119
#ifdef CONFIG_ANDROID_BINDER_IPC_SELFTEST

0 commit comments

Comments
 (0)