[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHRSSEzPv__6Mzyme2vhwLjg8fYcpoO40bJNufhFpyj4nw69pw@mail.gmail.com>
Date: Mon, 22 Jan 2018 08:54:42 -0800
From: Todd Kjos <tkjos@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Vitaly Wool <vitalywool@...il.com>,
Arve Hjønnevåg <arve@...roid.com>,
Todd Kjos <tkjos@...roid.com>,
Martijn Coenen <maco@...roid.com>,
Oleksiy.Avramchenko@...y.com, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] binder: use lockless list for deferred_work
Vitaly, can you say more about the behavior you observed that led you
to make this change? It is not obvious what workload would cause the
contention on this mutex to make a difference (at least in an Android
environment).
On Mon, Jan 22, 2018 at 7:44 AM, Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
> On Mon, Jan 08, 2018 at 02:55:18PM +0100, Vitaly Wool wrote:
>> Binder uses hlist for deferred list, which isn't a good match.
>> It's slow and requires mutual exclusion mechanism to protect its
>> operations. Moreover, having schedule_work() called under a mutex
>> may cause significant delays and creates noticeable adverse effect
>> on Binder performance.
>>
>> Deferred list in Binder is actually treated in a very simple way:
>> either add an entry to it or delete the first entry from it. llist
>> (lockless list) is a good match for such usage pattern, and it is
>> of course quite a bit faster and doesn't require locking.
>>
>> To be able to add an entry to an llist only if it's not already on
>> another llist, this patch adds two small helper functions. That is,
>> llist_add_exclusive would only add a node if it's not already on a
>> list, and llist_del_first_exclusive will delete the first node off
>> the list and mark it as not being on any list.
>>
>> Signed-off-by: Vitaly Vul <vitaly.vul@...y.com>
>> ---
>> drivers/android/binder.c | 87 ++++++++++++++++++++++++++++++++++++------------
>> 1 file changed, 66 insertions(+), 21 deletions(-)
>
> Martijn and Todd, any objections to this patch?
>
> thanks,
>
> greg k-h
Powered by blists - more mailing lists