diff options
author | Sherry Yang <sherryy@android.com> | 2017-08-23 17:46:42 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-08-28 16:47:17 +0200 |
commit | f2517eb76f1f2f7f89761f9db2b202e89931738c (patch) | |
tree | d15ad6ea85358e44e7ff92b7188dfa21e36560d9 /drivers/android/binder.c | |
parent | android: binder: Move buffer out of area shared with user space (diff) | |
download | linux-f2517eb76f1f2f7f89761f9db2b202e89931738c.tar.xz linux-f2517eb76f1f2f7f89761f9db2b202e89931738c.zip |
android: binder: Add global lru shrinker to binder
Hold on to the pages allocated and mapped for transaction
buffers until the system is under memory pressure. When
that happens, use linux shrinker to free pages. Without
using shrinker, patch "android: binder: Move buffer out
of area shared with user space" will cause a significant
slow down for small transactions that fit into the first
page because free list buffer header used to be inlined
with buffer data.
In addition to prevent the performance regression for
small transactions, this patch improves the performance
for transactions that take up more than one page.
Modify alloc selftest to work with the shrinker change.
Test: Run memory intensive applications (Chrome and Camera)
to trigger shrinker callbacks. Binder frees memory as expected.
Test: Run binderThroughputTest with high memory pressure
option enabled.
Signed-off-by: Sherry Yang <sherryy@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/android/binder.c')
-rw-r--r-- | drivers/android/binder.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index e4b6055aafc7..ba9e613b42d6 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -5243,6 +5243,8 @@ static int __init binder_init(void) struct binder_device *device; struct hlist_node *tmp; + binder_alloc_shrinker_init(); + atomic_set(&binder_transaction_log.cur, ~0U); atomic_set(&binder_transaction_log_failed.cur, ~0U); |