From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 22 Jan 2018 16:44:28 +0100 From: Greg Kroah-Hartman To: Vitaly Wool Cc: Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Oleksiy.Avramchenko@sony.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] binder: use lockless list for deferred_work Message-ID: <20180122154428.GA6879@kroah.com> References: <20180108145518.1f39ea095da6dd4fbbf660cb@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180108145518.1f39ea095da6dd4fbbf660cb@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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 > --- > drivers/android/binder.c | 87 ++++++++++++++++++++++++++++++++++++------------ > 1 file changed, 66 insertions(+), 21 deletions(-) Martijn and Todd, any objections to this patch? thanks, greg k-h