From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from bombadil.infradead.org ([198.137.202.133]:41892 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755092AbeFNN3K (ORCPT ); Thu, 14 Jun 2018 09:29:10 -0400 Date: Thu, 14 Jun 2018 06:29:05 -0700 From: Matthew Wilcox To: Thomas Hellstrom Cc: Peter Zijlstra , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Ingo Molnar , Jonathan Corbet , Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , Davidlohr Bueso , "Paul E. McKenney" , Josh Triplett , Thomas Gleixner , Kate Stewart , Philippe Ombredanne , Greg Kroah-Hartman , linux-doc@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: Re: [PATCH v2 1/2] locking: Implement an algorithm choice for Wound-Wait mutexes Message-ID: <20180614132905.GA7841@bombadil.infradead.org> References: <20180614072922.8114-1-thellstrom@vmware.com> <20180614072922.8114-2-thellstrom@vmware.com> <20180614113604.GZ12198@hirez.programming.kicks-ass.net> <7eb10c22-57b3-1472-0a77-7f787f612217@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7eb10c22-57b3-1472-0a77-7f787f612217@vmware.com> Sender: linux-media-owner@vger.kernel.org List-ID: On Thu, Jun 14, 2018 at 01:54:15PM +0200, Thomas Hellstrom wrote: > On 06/14/2018 01:36 PM, Peter Zijlstra wrote: > > Currently you don't allow mixing WD and WW contexts (which is not > > immediately obvious from the above code), and the above hard relies on > > that. Are there sensible use cases for mixing them? IOW will your > > current restriction stand without hassle? > > Contexts _must_ agree on the algorithm used to resolve deadlocks. With > Wait-Die, for example, older transactions will wait if a lock is held by a > younger transaction and with Wound-Wait, younger transactions will wait if a > lock is held by an older transaction so there is no way of mixing them. Maybe the compiler should be enforcing that; ie make it a different type?