Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3239197ybd; Fri, 28 Jun 2019 05:20:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4M3i3bgzOXbRyxt3XdcB+6agjOZlGfRldK/xckPURqLhpziurHDTRoHK0tK7W6FFN4S46 X-Received: by 2002:a17:90a:9b8a:: with SMTP id g10mr12608852pjp.66.1561724429814; Fri, 28 Jun 2019 05:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561724429; cv=none; d=google.com; s=arc-20160816; b=fzYfVXuFfQkiCaJkrSGB74CmIGfcf3Nq9Jo2njBW7zvUAkeHJmB22A811g8fKS3FLt p3BmmOoPWXrccSiuv8JSbxpOKOeoqfa6r6ObHejTaXC+Cm4bGvVNrivbKCZCEei8jYA8 lAZVnWclTb473FEwozVu3SPMVj+BoAOiljzda3k/YvrP9/Mc8IF/HEhasU9e5SYOGTFu rG0Pyo/2ZOKHqdD4sX0jjfECRqsTKfiqvpgQ6Wcnr7ljk54KYcg6T1A37Hh7Vo8eTfWm CXeDkr3W9XTvtODQd6rCgv2mc6FwrhyabTPJqAUTUorKNWSEzQHBuKKVCeBhIwiGaZRe jk/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :reply-to:message-id:subject:cc:to:from:date; bh=Csi1uohAefkjgYRnCV6Ytb4DcISPRbowrerEH6Zp0dg=; b=Z/s3gmWDnG7ktktbyq4LVmqM5fn+X79aIx9lYnixLTLchzm1xzFKtyc7f2OsIuL22w mSMnIr4vOk/HpmwgfwOwojywRRIH2WU/p4NwgkT8YHEZRk0mt94bBNV3dAFhieKC1q/u GuPQvvJVq3mWpA08Y+iWJSQlV1pCeCwcioEPpNn7QdrHW2TJoV6TAnt5zvII+LeeMVLM urnQ5IKvBoC76oYhDRGnGQB/Z2KBV+/CEnEeTqn+yBchtngyut7ym0GOlkOwsgKjvrEF uQ2dWbhOlrBmg6Td2DhokkCYW5hM1Qm8CRQ5Kv1Yi5z8ZnYXCm818Y5Fr9/+GDNQa/I+ X76w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si2005257pld.418.2019.06.28.05.20.12; Fri, 28 Jun 2019 05:20:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726653AbfF1MUG (ORCPT + 99 others); Fri, 28 Jun 2019 08:20:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:58616 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726542AbfF1MUG (ORCPT ); Fri, 28 Jun 2019 08:20:06 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id EF75CAFFA; Fri, 28 Jun 2019 12:20:04 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 7F892DAC70; Fri, 28 Jun 2019 14:20:48 +0200 (CEST) Date: Fri, 28 Jun 2019 14:20:47 +0200 From: David Sterba To: David Sterba Cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] lockdep: introduce lockdep_assert_not_held() Message-ID: <20190628122047.GG20977@suse.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, David Sterba , peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org References: <20190613133604.9889-1-dsterba@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190613133604.9889-1-dsterba@suse.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 13, 2019 at 03:36:04PM +0200, David Sterba wrote: > Add an assertion that a lock is not held, suitable for the following > (simplified) usecase in filesystems: > > - filesystem write > - lock(&big_filesystem_lock) > - kmalloc(GFP_KERNEL) > - trigger dirty data write to get more memory > - find dirty pages > - call filesystem write > - lock(&big_filesystem_lock) > deadlock > > The cause here is the use of GFP_KERNEL that does not exclude poking > filesystems to allow freeing some memory. Such scenario is a bug, so the > use of GFP_NOFS is the right flag. > > The annotation can help catch such bugs during development because > the actual deadlock could be hard to hit in practice. > > Signed-off-by: David Sterba Any comments on that? I just found another case with convoluted callstacks where the lockdep assertion would catch the potential lock up earlier than under the testing load.