From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751976AbbIEMFJ (ORCPT ); Sat, 5 Sep 2015 08:05:09 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:35014 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbbIEMFC (ORCPT ); Sat, 5 Sep 2015 08:05:02 -0400 Date: Sat, 5 Sep 2015 14:04:57 +0200 From: Ingo Molnar To: Thomas Gleixner Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-rt-users , Carsten Emde , Sebastian Andrzej Siewior , John Kacur , Paul Gortmaker , Peter Zijlstra , Clark Williams , Arnaldo Carvalho de Melo Subject: Re: [RFC][PATCH RT 0/3] RT: Fix trylock deadlock without msleep() hack Message-ID: <20150905120457.GA21338@gmail.com> References: <20150904011900.730816481@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Thomas Gleixner wrote: > So the problem we need to solve is: > > retry: > lock(B); > if (!try_lock(A)) { > unlock(B); > cpu_relax(); > goto retry; > } > > So instead of doing that proposed magic boost, we can do something > more straight forward: > > retry: > lock(B); > if (!try_lock(A)) { > lock_and_drop(A, B); > unlock(A); > goto retry; > } > > lock_and_drop() queues the task as a waiter on A, drops B and then > does the PI adjustment on A. > > Thoughts? So why not do: lock(B); if (!trylock(A)) { unlock(B); lock(A); lock(B); } ? Or, if this can be done, why didn't we do: lock(A); lock(B); to begin with? i.e. I'm not sure the problem is properly specified. Thanks, Ingo