From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753619AbbCJP2b (ORCPT ); Tue, 10 Mar 2015 11:28:31 -0400 Received: from casper.infradead.org ([85.118.1.10]:38707 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751778AbbCJP2a (ORCPT ); Tue, 10 Mar 2015 11:28:30 -0400 Date: Tue, 10 Mar 2015 16:28:26 +0100 From: Peter Zijlstra To: Maarten Lankhorst Cc: Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, Ingo Molnar , Mike Galbraith Subject: Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock Message-ID: <20150310152826.GE2896@worktop.programming.kicks-ass.net> References: <1425056229-22326-1-git-send-email-bigeasy@linutronix.de> <1425056229-22326-3-git-send-email-bigeasy@linutronix.de> <20150310123740.GA2896@worktop.programming.kicks-ass.net> <54FEFB66.1070606@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54FEFB66.1070606@canonical.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 10, 2015 at 03:10:46PM +0100, Maarten Lankhorst wrote: > Op 10-03-15 om 13:37 schreef Peter Zijlstra: > > So IIRC this is the function that checks who gets wounded (and gets to > > do the whole retry thing), right? > > > > So for the RT case, I think we should extend it to not (primarily) be a > > FIFO thing, but also consider the priority of the tasks involved. > > > > Maybe a little something like: > > > > if (hold_ctx->task->prio < ctx->task->prio) > > return -EDEADLOCK; > > > > before the timestamp check; although I suppose we should also add a > > deadline test in case both prios are -1. > I think that's useful but if you implement -EDEADLK based on thread > priority, any boosted thread should receive -EDEADLK when it tries to > acquire a new lock in the same context, to force it to back off.. But _only_ if the boost comes from inside the ww_ctx, right? Yeah, implementing that might be tricky, maybe we can keep it as a note for now ;)