Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1614276

Re: [RFC PATCH] binder: Don't require the binder lock when killed in binder_thread_read()

From Greg KH <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] binder: Don't require the binder lock when killed in binder_thread_read()
Date 2017-03-31 21:40 +0200
Message-ID <trayR-r5-5@gated-at.bofh.it> (permalink)
References <tr907-7Ov-43@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Mar 31, 2017 at 10:53:41AM -0700, Douglas Anderson wrote:
> Sometimes when we're out of memory the OOM killer decides to kill a
> process that's in binder_thread_read().  If we happen to be waiting
> for work we'll get the kill signal and wake up.  That's good.  ...but
> then we try to grab the binder lock before we return.  That's bad.
> 
> The problem is that someone else might be holding the one true global
> binder lock.  If that one other process is blocked then we can't
> finish exiting.  In the worst case, the other process might be blocked
> waiting for memory.  In that case we'll have a really hard time
> exiting.
> 
> On older kernels that don't have the OOM reaper (or something
> similar), like kernel 4.4, this is a really big problem and we end up
> with a simple deadlock because:
> * Once we pick a process to OOM kill we won't pick another--we first
>   wait for the process we picked to die.  The reasoning is that we've
>   given the doomed process access to special memory pools so it can
>   quit quickly and we don't have special pool memory to go around.
> * We don't have any type of "special access donation" that would give
>   the mutex holder our special access.
> 
> On kernel 4.4 w/ binder patches, we easily see this happen:

<snip>

How does your change interact with the recent "break up the binder big
lock" patchset:
	https://android-review.googlesource.com/#/c/354698/

Have you tried that series out to see if it helps out any?

thanks,

greg k-h

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] binder: Don't require the binder lock when killed in binder_thread_read() Douglas Anderson <dianders@chromium.org> - 2017-03-31 20:00 +0200
  Re: [RFC PATCH] binder: Don't require the binder lock when killed in  binder_thread_read() Greg KH <gregkh@linuxfoundation.org> - 2017-03-31 21:40 +0200
    Re: [RFC PATCH] binder: Don't require the binder lock when killed in binder_thread_read() Doug Anderson <dianders@chromium.org> - 2017-03-31 23:10 +0200
      Re: [RFC PATCH] binder: Don't require the binder lock when killed in  binder_thread_read() Greg KH <gregkh@linuxfoundation.org> - 2017-04-01 08:50 +0200
        Re: [RFC PATCH] binder: Don't require the binder lock when killed in binder_thread_read() Doug Anderson <dianders@chromium.org> - 2017-04-02 04:40 +0200
          Re: [RFC PATCH] binder: Don't require the binder lock when killed in  binder_thread_read() Greg KH <gregkh@linuxfoundation.org> - 2017-04-03 15:30 +0200
            Re: [RFC PATCH] binder: Don't require the binder lock when killed in binder_thread_read() Doug Anderson <dianders@chromium.org> - 2017-04-03 20:10 +0200
              Re: [RFC PATCH] binder: Don't require the binder lock when killed in  binder_thread_read() Michal Hocko <mhocko@kernel.org> - 2017-04-04 09:50 +0200
                Re: [RFC PATCH] binder: Don't require the binder lock when killed in binder_thread_read() Doug Anderson <dianders@chromium.org> - 2017-04-04 17:20 +0200
                Re: [RFC PATCH] binder: Don't require the binder lock when killed in  binder_thread_read() Michal Hocko <mhocko@kernel.org> - 2017-04-04 17:30 +0200
  Re: [RFC PATCH] binder: Don't require the binder lock when killed in  binder_thread_read() peter enderborg <peter.enderborg@sonymobile.com> - 2017-04-03 15:50 +0200

csiph-web