Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755121Ab2BPTLq (ORCPT ); Thu, 16 Feb 2012 14:11:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4662 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755113Ab2BPTLe (ORCPT ); Thu, 16 Feb 2012 14:11:34 -0500 Date: Thu, 16 Feb 2012 19:49:19 +0100 From: Oleg Nesterov To: Vasiliy Kulikov Cc: Cyrill Gorcunov , 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: <20120216184919.GA1934@redhat.com> References: <20120215195610.GJ4533@moon> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120216182106.GA17020@albatros> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 767 Lines: 30 On 02/16, 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) Please note the if (m1 >= m2) swap(m1. m2) at the start. Oleg. -- 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/