diff options
| author | Sherry Yang <sherryy@android.com> | 2017-10-03 19:15:00 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-03 20:54:24 -0400 |
| commit | a1b2289cef92ef0e9a92afcd2e1ea71d5bcaaf64 (patch) | |
| tree | c3d9ab6e1ff17de869d3497dd44be5d70340c97f /kernel | |
| parent | 3f2eb0287ebd62ec8d6d544f830285302279e6bf (diff) | |
android: binder: drop lru lock in isolate callback
Drop the global lru lock in isolate callback before calling
zap_page_range which calls cond_resched, and re-acquire the global lru
lock before returning. Also change return code to LRU_REMOVED_RETRY.
Use mmput_async when fail to acquire mmap sem in an atomic context.
Fix "BUG: sleeping function called from invalid context"
errors when CONFIG_DEBUG_ATOMIC_SLEEP is enabled.
Also restore mmput_async, which was initially introduced in commit
ec8d7c14ea14 ("mm, oom_reaper: do not mmput synchronously from the oom
reaper context"), and was removed in commit 212925802454 ("mm: oom: let
oom_reap_task and exit_mmap run concurrently").
Link: http://lkml.kernel.org/r/20170914182231.90908-1-sherryy@android.com
Fixes: f2517eb76f1f2 ("android: binder: Add global lru shrinker to binder")
Signed-off-by: Sherry Yang <sherryy@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reported-by: Kyle Yan <kyan@codeaurora.org>
Acked-by: Arve Hjønnevåg <arve@android.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Martijn Coenen <maco@google.com>
Cc: Todd Kjos <tkjos@google.com>
Cc: Riley Andrews <riandrews@android.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Hoeun Ryu <hoeun.ryu@gmail.com>
Cc: Christopher Lameter <cl@linux.com>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/fork.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 10646182440f..e702cb9ffbd8 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -946,6 +946,24 @@ void mmput(struct mm_struct *mm) | |||
| 946 | } | 946 | } |
| 947 | EXPORT_SYMBOL_GPL(mmput); | 947 | EXPORT_SYMBOL_GPL(mmput); |
| 948 | 948 | ||
| 949 | #ifdef CONFIG_MMU | ||
| 950 | static void mmput_async_fn(struct work_struct *work) | ||
| 951 | { | ||
| 952 | struct mm_struct *mm = container_of(work, struct mm_struct, | ||
| 953 | async_put_work); | ||
| 954 | |||
| 955 | __mmput(mm); | ||
| 956 | } | ||
| 957 | |||
| 958 | void mmput_async(struct mm_struct *mm) | ||
| 959 | { | ||
| 960 | if (atomic_dec_and_test(&mm->mm_users)) { | ||
| 961 | INIT_WORK(&mm->async_put_work, mmput_async_fn); | ||
| 962 | schedule_work(&mm->async_put_work); | ||
| 963 | } | ||
| 964 | } | ||
| 965 | #endif | ||
| 966 | |||
| 949 | /** | 967 | /** |
| 950 | * set_mm_exe_file - change a reference to the mm's executable file | 968 | * set_mm_exe_file - change a reference to the mm's executable file |
| 951 | * | 969 | * |
