Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754594Ab2BPSiJ (ORCPT ); Thu, 16 Feb 2012 13:38:09 -0500 Received: from mail-bk0-f46.google.com ([209.85.214.46]:63992 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754322Ab2BPSiH (ORCPT ); Thu, 16 Feb 2012 13:38:07 -0500 Date: Thu, 16 Feb 2012 22:33:16 +0400 From: Vasiliy Kulikov To: Cyrill Gorcunov Cc: Oleg Nesterov , Andrew Morton , "Eric W. Biederman" , Pavel Emelyanov , Andrey Vagin , KOSAKI Motohiro , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Glauber Costa , Andi Kleen , Tejun Heo , Matt Helsley , Pekka Enberg , Eric Dumazet , Alexey Dobriyan , Valdis.Kletnieks@vt.edu, Michal Marek , Frederic Weisbecker , linux-kernel@vger.kernel.org Subject: Re: + syscalls-x86-add-__nr_kcmp-syscall-v8.patch added to -mm tree Message-ID: <20120216183316.GA17636@albatros> References: <20120215195733.GA8021@albatros> <20120215200533.GQ1894@moon> <20120215202538.GK4533@moon> <20120215210934.GL4533@moon> <20120215215807.GM4533@moon> <20120216144954.GA11953@redhat.com> <20120216151340.GI1905@moon> <20120216164901.GD3849@moon> <20120216182106.GA17020@albatros> <20120216183455.GL1905@moon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120216183455.GL1905@moon> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1112 Lines: 30 On Thu, Feb 16, 2012 at 22:34 +0400, Cyrill Gorcunov wrote: > On Thu, Feb 16, 2012 at 10:21:06PM +0400, Vasiliy Kulikov wrote: > > On Thu, Feb 16, 2012 at 20:49 +0400, Cyrill Gorcunov wrote: > > > + err = mutex_lock_killable(m1); > > > + if (!err && likely(m1 != m2)) { > > > + err = mutex_lock_killable_nested(m2, SINGLE_DEPTH_NESTING); > > > > Doesn't it lead to a deadlock? > > > > mutex_lock_killable(task1) > > | mutex_lock_killable(task2) > > mutex_lock_killable_nested(task2) | > > (locked) | > > mutex_lock_killable_nested(task1) > > (locked) > > > > I suppose you should use some global lock (kcmp_lock) before both locks. > > but here is if (m1 > m2) and swap() do take place. Ah, ok. Then this deadlock scenario is impossible, sorry. -- Vasiliy Kulikov http://www.openwall.com - bringing security into open computing environments -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/