aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/android/binder_alloc.h
diff options
context:
space:
mode:
authorSherry Yang <sherryy@android.com>2017-08-23 08:46:40 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-28 16:47:17 +0200
commit4175e2b46fd4b9021ef81f18f1be9474b2f45d4a (patch)
treef71d84f71001cecc96563950400c15f609375619 /drivers/android/binder_alloc.h
parentandroid: binder: Refactor prev and next buffer into a helper function (diff)
downloadlinux-dev-4175e2b46fd4b9021ef81f18f1be9474b2f45d4a.tar.xz
linux-dev-4175e2b46fd4b9021ef81f18f1be9474b2f45d4a.zip
android: binder: Add allocator selftest
binder_alloc_selftest tests that alloc_new_buf handles page allocation and deallocation properly when allocate and free buffers. The test allocates 5 buffers of various sizes to cover all possible page alignment cases, and frees the buffers using a list of exhaustive freeing order. Test: boot the device with ANDROID_BINDER_IPC_SELFTEST config option enabled. Allocator selftest passes. Signed-off-by: Sherry Yang <sherryy@android.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/android/binder_alloc.h')
-rw-r--r--drivers/android/binder_alloc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h
index 088e4ffc6230..4f02cc084c15 100644
--- a/drivers/android/binder_alloc.h
+++ b/drivers/android/binder_alloc.h
@@ -102,6 +102,11 @@ struct binder_alloc {
int pid;
};
+#ifdef CONFIG_ANDROID_BINDER_IPC_SELFTEST
+void binder_selftest_alloc(struct binder_alloc *alloc);
+#else
+static inline void binder_selftest_alloc(struct binder_alloc *alloc) {}
+#endif
extern struct binder_buffer *binder_alloc_new_buf(struct binder_alloc *alloc,
size_t data_size,
size_t offsets_size,