Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp932752ybl; Wed, 28 Aug 2019 07:23:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNxBNWEvKEOgLEitPrlG3w298SYjRJtFgejagRe3NLFMq/YS/Y7y/G14W+l+j6ohyscO5Q X-Received: by 2002:a65:64c6:: with SMTP id t6mr3751072pgv.323.1567002185076; Wed, 28 Aug 2019 07:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567002185; cv=none; d=google.com; s=arc-20160816; b=RopMTbPSeocE9aom+HDbGQdq2cY1lfUDmGK7cDSd9zWJY3YnhV0O2+WtJhfhwxrT9V rdtXYkXEE+hUWYM4AQfRlE5XodrD0vY55OFYnukP32Joc+NB6o92WdguUNjG++xPksen OYEYebNyb8kpPu05k0k2fvR9RB+pnLbg2T6YeZjjn2balQ3w3Wy+rq0f1ANgUxumlBv/ tU33KaAvSc66p2hJNwe1Md8l2hCZ3GwCYgH/6NkbU8sG/8/4qVNV33vNPG+0hjQpG2FW 9vX1ul6QlHEQYYqCm+RcW0uWYniijkrBV4DGGeIq6B+Er2OKwukn1cb9I/C7AowyD4qs rXdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zl4G8WtuziQvLKFqDgMdC9UCvqeacC6em8tdHCZigf0=; b=mkvQEfRzrs3qP0PrcnBTy1oq6YOnTnF+smsDQXCgSYPV6GRY0yQfeM1MevTBpN4dl0 D5zYjW4zUvf4EIRZ1Xd/qMOSZ+QgurOqVTATdpa53jJM/K9qGKUaEJJi/vulIX5yK27E rqOffCM6HG2/itlTdeqaCyriq/5LbNXCOJigH+PNYRSIZjGEOC2oahRMVPaN0xUSQYgL 9mGH3szE99nNmLKgRAVFfZKyIGE6wTv7a8h3Ih7N7YftnBnGA5P28NdEvGZiJegLJB77 pxcGhMZH7WlBJ9dVdnAYQxtgygB8B/sBCTAqr220GrBVkk23cYxCR77dDzB2n6BU408u eAIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=OkB8WmnO; 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 ck3si1989493plb.429.2019.08.28.07.22.49; Wed, 28 Aug 2019 07:23:05 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=OkB8WmnO; 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 S1727065AbfH1OUM (ORCPT + 99 others); Wed, 28 Aug 2019 10:20:12 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:45916 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbfH1OUK (ORCPT ); Wed, 28 Aug 2019 10:20:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zl4G8WtuziQvLKFqDgMdC9UCvqeacC6em8tdHCZigf0=; b=OkB8WmnON97oS6Y/JoC0YQ4U0E IslxnmG7+sUaZwQg4Yi1yE68jOJc8TkEnEfgn7GdDAYmzNN+0GVCubBhKmjjcDXg/H32Nz8ZDKaTb 19DGkJh2XSDQ48/p5CJFqPFr7krGLZvjpZ460jfdJ+r61yH2Ng3CZyvliJ4Bawc4gKd/RwGomc08I nHnqQ6SuMzevS/QTCFkiztqG2QNar+ZUvWNRYmSNrFc+gKZbX0qQ2TUR0qQ3pnnXA4CJ2OTC0S4Ql nns156DI7AWQKjg5dAKWdppB4FbZNora49ZcfbYVr4aq4Uc1PccDeBxlA7zrI3veBTAk5a0neMhrV h2OQOU2A==; Received: from [2001:4bb8:180:3f4c:863:2ead:e9d4:da9f] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i2ynu-0004SO-I3; Wed, 28 Aug 2019 14:20:06 +0000 From: Christoph Hellwig To: Linus Torvalds , Andrew Morton Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Jerome Glisse , Jason Gunthorpe , Steven Price , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Thomas Hellstrom Subject: [PATCH 3/3] pagewalk: use lockdep_assert_held for locking validation Date: Wed, 28 Aug 2019 16:19:55 +0200 Message-Id: <20190828141955.22210-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190828141955.22210-1-hch@lst.de> References: <20190828141955.22210-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use lockdep to check for held locks instead of using home grown asserts. Signed-off-by: Christoph Hellwig Reviewed-by: Thomas Hellstrom Reviewed-by: Steven Price --- mm/pagewalk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/pagewalk.c b/mm/pagewalk.c index b8762b673a3d..d48c2a986ea3 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -317,7 +317,7 @@ int walk_page_range(struct mm_struct *mm, unsigned long start, if (!walk.mm) return -EINVAL; - VM_BUG_ON_MM(!rwsem_is_locked(&walk.mm->mmap_sem), walk.mm); + lockdep_assert_held(&walk.mm->mmap_sem); vma = find_vma(walk.mm, start); do { @@ -367,7 +367,7 @@ int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops, if (!walk.mm) return -EINVAL; - VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); + lockdep_assert_held(&walk.mm->mmap_sem); err = walk_page_test(vma->vm_start, vma->vm_end, &walk); if (err > 0) -- 2.20.1