[PATCH] android: binder: no outgoing transaction when thread todo has transaction

2018-08-13 Thread Sherry Yang
ds that are waiting for proc work can directly receive work from another thread, and no work is allowed to be queued on such a thread without waking up the thread. This patch also enforces that a thread is not waiting for proc work when a work is directly enqueued to its todo list. Acked-by: Arve

[PATCH v2] android: binder: Rate-limit debug and userspace triggered err msgs

2018-08-07 Thread Sherry Yang
Use rate-limited debug messages where userspace can trigger excessive log spams. Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- v2: rebase onto char-misc-next to resolve include order difference from master drivers/android/binder.c | 5 +++-- drivers/android/binder_alloc.c

[PATCH 0/2] android: binder: debug message improvements

2018-07-26 Thread Sherry Yang
This patch set includes extra_buffers_size in trace so that the total transaction size can be inferred. It also ratelimits debug messages to avoid excessive log spams reported by sysbot. android: binder: Show extra_buffers_size in trace android: binder: Rate-limit debug and userspace trigg

[PATCH 2/2] android: binder: Rate-limit debug and userspace triggered err msgs

2018-07-26 Thread Sherry Yang
Use rate-limited debug messages where userspace can trigger excessive log spams. Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/binder.c | 5 +++-- drivers/android/binder_alloc.c | 41 +- 2 files changed, 29 insertions(+), 17

[PATCH 1/2] android: binder: Show extra_buffers_size in trace

2018-07-26 Thread Sherry Yang
Add extra_buffers_size to the binder_transaction_alloc_buf tracepoint. Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/binder_trace.h | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/android/binder_trace.h b/drivers/android

[PATCH v2 2/4] android: binder: Fix null ptr dereference in debug msg

2017-10-20 Thread Sherry Yang
Don't access next->data in kernel debug message when the next buffer is null. Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/binder_alloc.c b/drivers

[PATCH v2 3/4] android: binder: Remove unused vma argument

2017-10-20 Thread Sherry Yang
The vma argument in update_page_range is no longer used after 74310e06 ("android: binder: Move buffer out of area shared with user space"), since mmap_handler no longer calls update_page_range with a vma. Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/bind

[PATCH v2 1/4] android: binder: Don't get mm from task

2017-10-20 Thread Sherry Yang
Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 22 +- drivers/android/binder_alloc.h | 1 - 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 064f5e3

[PATCH v2 4/4] android: binder: Change binder_shrinker to static

2017-10-20 Thread Sherry Yang
binder_shrinker struct is not used anywhere outside of binder_alloc.c and should be static. Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/binder_alloc.c b/drivers

[PATCH v2 0/4] android: binder: fixes for memory allocator change

2017-10-20 Thread Sherry Yang
This patchset resolves a potential deadlock between lru lock, task lock and dentry lock reported by lockdep. It also fixes the null pointer dereference in kernel debug message in binder_alloc.c. Unused vma argument is removed, and binder shrinker is made static. android: binder: Don't get mm f

[PATCH 2/2] android: binder: Fix null ptr dereference in debug msg

2017-10-06 Thread Sherry Yang
Don't access next->data in kernel debug message when the next buffer is null. Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/binder_alloc.c b/drivers

[PATCH 1/2] android: binder: Change binder_shrinker to static

2017-10-06 Thread Sherry Yang
binder_shrinker struct is not used anywhere outside of binder_alloc.c and should be static. Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/binder_alloc.c b/drivers

Make binder shrinker static and fix null dereference

2017-10-06 Thread Sherry Yang
This patch set makes binder shrinker static and fixes the null pointer dereference in kernel debug message in binder_alloc.c. The earlier patches from this email thread ("android: binder: Remove unused vma argument" and "android: binder: Remove unused vma argument") need to be applied before these

[PATCH 0/2] android: binder: resolve lru, dentry and task deadlock

2017-09-15 Thread Sherry Yang
This patch set removes the unused vma argument in update_page_range and resolves a potential deadlock between lru lock, task lock and dentry lock reported by lockdep. android: binder: Don't get mm from task android: binder: Remove unused vma argument drivers/android/binder_alloc.c | 36 ++

[PATCH 2/2] android: binder: Don't get mm from task

2017-09-15 Thread Sherry Yang
Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 22 +- drivers/android/binder_alloc.h | 1 - 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index b87ecf7

[PATCH 1/2] android: binder: Remove unused vma argument

2017-09-15 Thread Sherry Yang
The vma argument in update_page_range is no longer used after 74310e06 ("android: binder: Move buffer out of area shared with user space"), since mmap_handler no longer calls update_page_range with a vma. Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/bind

[PATCH v2] android: binder: Drop lru lock in isolate callback

2017-09-14 Thread Sherry Yang
m_reap_task and exit_mmap run concurrently"). Fixes: f2517eb76f1f2 ("android: binder: Add global lru shrinker to binder") Reported-by: Kyle Yan Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- Changes in v2: Combined '[PATCH] android: binder: Drop lru lock in isolate ca

Re: [PATCH] mm: Restore mmput_async

2017-09-13 Thread Sherry Yang
The patch that uses mmput_async() is https://lkml.org/lkml/2017/9/8/785. Gmail doesn't seem to respect in-reply-to. On Wed, Sep 13, 2017 at 6:09 PM, Andrew Morton wrote: > On Wed, 13 Sep 2017 17:59:27 -0400 Sherry Yang wrote: > >> Restore asynchronous mmput, allowing mmput_a

[PATCH] mm: Restore mmput_async

2017-09-13 Thread Sherry Yang
ot;mm: oom: let oom_reap_task and exit_mmap run concurrently") Signed-off-by: Sherry Yang --- include/linux/sched/mm.h | 6 ++ kernel/fork.c| 18 ++ 2 files changed, 24 insertions(+) diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index 3a19c2

Re: [PATCH 2/5] android: binder: Add allocator selftest

2017-09-10 Thread Sherry Yang
est is not enabled. Thanks, Sherry On Sun, Sep 10, 2017 at 7:48 AM, Geert Uytterhoeven wrote: > Hi Sherry, > > On Wed, Aug 16, 2017 at 2:25 AM, Sherry Yang wrote: >> binder_alloc_selftest tests that alloc_new_buf handles page allocation and >> deallocation properly when allo

[PATCH] android: binder: Drop lru lock in isolate callback

2017-09-08 Thread Sherry Yang
ction called from invalid context" errors when CONFIG_DEBUG_ATOMIC_SLEEP is enabled. Fixes: f2517eb76f1f2 ("android: binder: Add global lru shrinker to binder") Reported-by: Kyle Yan Acked-by: Arve Hjønnevåg Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 18 ++

[PATCH] android: binder: Add page usage in binder stats

2017-08-31 Thread Sherry Yang
Add the number of active, lru, and free pages for each binder process in binder stats Signed-off-by: Sherry Yang --- drivers/android/binder.c | 2 ++ drivers/android/binder_alloc.c | 28 drivers/android/binder_alloc.h | 2 ++ 3 files changed, 32 insertions

Re: [PATCH v3 1/6] android: binder: Refactor prev and next buffer into a helper function

2017-08-31 Thread Sherry Yang
On Wed, Aug 30, 2017 at 9:28 PM, Greg Kroah-Hartman wrote: > Ok, exactly what git commit ids should I revert from the tree? But > really, a fix would be easier at this point :) I sent a fixup patch as a separate reply to this email. Please also apply [patch v3 6/6] as it was not in v2, which you

[PATCH] android: binder: fixup crash introduced by moving buffer hdr

2017-08-31 Thread Sherry Yang
Fix crash introduced by 74310e06be4d74dcf67cd108366710dee5c576d5 (android: binder: Move buffer out of area shared with user space) when close is called after open without mmap in between. Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1

Re: [PATCH v3 1/6] android: binder: Refactor prev and next buffer into a helper function

2017-08-30 Thread Sherry Yang
On Tue, Aug 29, 2017 at 11:07 PM, Greg Kroah-Hartman wrote: > On Tue, Aug 29, 2017 at 05:46:57PM -0700, Sherry Yang wrote: >> Use helper functions buffer_next and buffer_prev instead >> of list_entry to get the next and previous buffers. >> >> Signed-off-by: Sher

[PATCH v3 1/6] android: binder: Refactor prev and next buffer into a helper function

2017-08-29 Thread Sherry Yang
Use helper functions buffer_next and buffer_prev instead of list_entry to get the next and previous buffers. Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/android/binder_alloc.c

[PATCH 0/6] android: binder: move allocator metadata and add shrinker

2017-08-29 Thread Sherry Yang
This patch set moves internal kernel data in the binder driver out of mmap regions that is readable by user space. A shrinker is added to the driver to dynamically manage the memory used by binder transactions and only free pages when the system is under memory pressure. This patch set also adds te

[PATCH v3 4/6] android: binder: Add global lru shrinker to binder

2017-08-29 Thread Sherry Yang
c 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 --- drivers/androi

[PATCH v3 2/6] android: binder: Add allocator selftest

2017-08-29 Thread Sherry Yang
device with ANDROID_BINDER_IPC_SELFTEST config option enabled. Allocator selftest passes. Signed-off-by: Sherry Yang --- drivers/android/Kconfig | 10 ++ drivers/android/Makefile| 1 + drivers/android/binder.c| 2 + drivers/android

[PATCH v3 6/6] android: binder: Add page usage in binder stats

2017-08-29 Thread Sherry Yang
Add the number of active, lru, and free pages for each binder process in binder stats Signed-off-by: Sherry Yang --- drivers/android/binder.c | 2 ++ drivers/android/binder_alloc.c | 28 drivers/android/binder_alloc.h | 2 ++ 3 files changed, 32 insertions

[PATCH v3 3/6] android: binder: Move buffer out of area shared with user space

2017-08-29 Thread Sherry Yang
ers initialization from mmap to init since it's now used even when mmap failed or was not called. Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 146 +++- drivers/android/binder_alloc.h | 2 +- drivers/android/binder_alloc_se

[PATCH v3 5/6] android: binder: Add shrinker tracepoints

2017-08-29 Thread Sherry Yang
Add tracepoints in binder transaction allocator to record lru hits and alloc/free page. Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 27 +++-- drivers/android/binder_trace.h | 55 ++ 2 files changed, 80 insertions(+), 2

[PATCH v2 0/5] android: binder: move allocator metadata and add shrinker

2017-08-23 Thread Sherry Yang
This patch set moves internal kernel data in the binder driver out of mmap regions that is readable by user space. A shrinker is added to the driver to dynamically manage the memory used by binder transactions and only free pages when the system is under memory pressure. This patch set also adds te

[PATCH v2 0/5] android: binder: move allocator metadata and add shrinker

2017-08-23 Thread Sherry Yang
This patch set moves internal kernel data in the binder driver out of mmap regions that is readable by user space. A shrinker is added to the driver to dynamically manage the memory used by binder transactions and only free pages when the system is under memory pressure. This patch set also adds te

[PATCH v2 3/5] android: binder: Move buffer out of area shared with user space

2017-08-23 Thread Sherry Yang
Binder driver allocates buffer meta data in a region that is mapped in user space. These meta data contain pointers in the kernel. This patch allocates buffer meta data on the kernel heap that is not mapped in user space, and uses a pointer to refer to the data mapped. Signed-off-by: Sherry Yang

[PATCH v2 5/5] android: binder: Add shrinker tracepoints

2017-08-23 Thread Sherry Yang
Add tracepoints in binder transaction allocator to record lru hits and alloc/free page. Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 27 +++-- drivers/android/binder_trace.h | 55 ++ 2 files changed, 80 insertions(+), 2

[PATCH v2 4/5] android: binder: Add global lru shrinker to binder

2017-08-23 Thread Sherry Yang
c 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 --- drivers/androi

[PATCH v2 1/5] android: binder: Refactor prev and next buffer into a helper function

2017-08-23 Thread Sherry Yang
Use helper functions buffer_next and buffer_prev instead of list_entry to get the next and previous buffers. Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/android/binder_alloc.c

[PATCH v2 2/5] android: binder: Add allocator selftest

2017-08-23 Thread Sherry Yang
device with ANDROID_BINDER_IPC_SELFTEST config option enabled. Allocator selftest passes. Signed-off-by: Sherry Yang --- drivers/android/Kconfig | 10 ++ drivers/android/Makefile| 1 + drivers/android/binder.c| 2 + drivers/android

[PATCH 2/5] android: binder: Add allocator selftest

2017-08-15 Thread Sherry Yang
device with ANDROID_BINDER_IPC_SELFTEST config option enabled. Allocator selftest passes. Change-Id: I9064f60c85b1e0389c88e927e2b147ec92cae0d1 Signed-off-by: Sherry Yang --- drivers/android/Kconfig | 10 ++ drivers/android/Makefile| 1 + drivers/android

[PATCH 0/5] android: binder: move allocator metadata and add shrinker

2017-08-15 Thread Sherry Yang
This patch set moves internal kernel data in the binder driver out of mmap regions that is readable by user space. A shrinker is added to the driver to dynamically manage the memory used by binder transactions and only free pages when the system is under memory pressure. This patch set also adds te

[PATCH 5/5] android: binder: Add shrinker tracepoints

2017-08-15 Thread Sherry Yang
Add tracepoints in binder transaction allocator to record lru hits and alloc/free page. Change-Id: I7715f943c57d6172c35bdff8298d8c5aef24a51a Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 27 +++-- drivers/android/binder_trace.h | 55

[PATCH 4/5] android: binder: Add global lru shrinker to binder

2017-08-15 Thread Sherry Yang
ned-off-by: Sherry Yang --- drivers/android/binder.c| 2 + drivers/android/binder_alloc.c | 172 +++- drivers/android/binder_alloc.h | 23 - drivers/android/binder_alloc_selftest.c | 68 ++--- 4 files changed, 225 inserti

[PATCH 3/5] android: binder: Move buffer out of area shared with user space

2017-08-15 Thread Sherry Yang
: Ie19d2393a5015d9ee8bc26c41ce27e6eaa6e52fb Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 144 +++- drivers/android/binder_alloc.h | 2 +- drivers/android/binder_alloc_selftest.c | 11 ++- 3 files changed, 90 insertions(+), 67 deletions(-) diff

[PATCH 1/5] android: binder: Refactor prev and next buffer into a helper function

2017-08-15 Thread Sherry Yang
Change-Id: Ie2a446ad9907f0d306fd1b8e6d79d87e48826ce2 Signed-off-by: Sherry Yang --- drivers/android/binder_alloc.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 40f31df60580