From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758655AbcINHKK (ORCPT ); Wed, 14 Sep 2016 03:10:10 -0400 Received: from merlin.infradead.org ([205.233.59.134]:47636 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751790AbcINHKI (ORCPT ); Wed, 14 Sep 2016 03:10:08 -0400 Date: Wed, 14 Sep 2016 09:10:01 +0200 From: Peter Zijlstra To: Arve =?iso-8859-1?B?SGr4bm5lduVn?= Cc: Greg Kroah-Hartman , Thomas Gleixner , "devel@driverdev.osuosl.org" , Riley Andrews , LKML , Christoph Hellwig , Todd Kjos Subject: Re: [PATCH] android: binder: Disable preemption while holding the global binder lock Message-ID: <20160914071001.GI5008@twins.programming.kicks-ass.net> References: <20160910161659.GA7987@infradead.org> <20160910162210.GK10153@twins.programming.kicks-ass.net> <20160910172843.GA17876@kroah.com> <20160913073259.GC5008@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 13, 2016 at 12:53:27PM -0700, Arve Hjønnevåg wrote: > On Tue, Sep 13, 2016 at 12:32 AM, Peter Zijlstra wrote: > > On Mon, Sep 12, 2016 at 08:44:09PM -0700, Arve Hjønnevåg wrote: > > > >> A previous attempt to fix this problem, changed the lock to use > >> rt_mutex instead of mutex, but this apparently did not work as well as > >> this patch. I believe the added overhead was noticeable, and it did > >> not work when the preempted thread was in a different cgroup (I don't > >> know if this is still the case). > > > > Do you actually have RR/FIFO/DL tasks? Currently PI isn't > > defined/implemented for OTHER. > > > > Most of the tasks here are not RR/FIFO/DL tasks. I don't see anything > in the rtmutex code or documentation that indicates that they don't > work for normal tasks. From what I can tell the priority gets boosted > in every case. This may not work as well for CFS tasks as for realtime > tasks, but it should at least help when there is a large priority > difference. It does something (it used to explicitly ignore OTHER) but its not something well defined or usable. > > cgroups should be irrelevant, PI is unaware of them. > > I don't think cgroups are irrelevant. PI being unaware of them > explains the problem I described. If the task that holds the lock is > in a cgroup that has a low cpu.shares value, then boosting the task's > priority within that group does necessarily make it any more likely to > run. See, the problem is that 'priority' is a meaningless concept for OTHER/CFS. In any case, typically only RT tasks care about PI, and the traditional Priority Inheritance algorithm only really works correctly for FIFO. As is RR has issues and DL is a crude hack, CFS is really just an accident by not explicitly exempting it. We could define a meaningful something for CFS and implement that, but it isn't currently done.