All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "Thomas Hellström" <thomas@shipmail.org>,
	"Jerome Glisse" <jglisse@redhat.com>,
	"Jason Gunthorpe" <jgg@mellanox.com>,
	"Steven Price" <steven.price@arm.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Thomas Hellstrom" <thellstrom@vmware.com>
Subject: [PATCH 3/3] pagewalk: use lockdep_assert_held for locking validation
Date: Wed, 28 Aug 2019 16:19:55 +0200	[thread overview]
Message-ID: <20190828141955.22210-4-hch@lst.de> (raw)
In-Reply-To: <20190828141955.22210-1-hch@lst.de>

Use lockdep to check for held locks instead of using home grown
asserts.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Steven Price <steven.price@arm.com>
---
 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


  parent reply	other threads:[~2019-08-28 14:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 14:19 cleanup the walk_page_range interface v2 Christoph Hellwig
2019-08-28 14:19 ` [PATCH 1/3] mm: split out a new pagewalk.h header from mm.h Christoph Hellwig
2019-08-29  9:05   ` Mike Rapoport
2019-08-29  9:16     ` Steven Price
2019-08-28 14:19 ` [PATCH 2/3] pagewalk: separate function pointers from iterator data Christoph Hellwig
2019-08-28 15:05   ` Jason Gunthorpe
2019-08-29  6:59     ` Christoph Hellwig
2019-09-01 18:45   ` Guenter Roeck
2019-09-01 19:36     ` Jason Gunthorpe
2019-09-01 20:35       ` Guenter Roeck
2019-09-02  5:51         ` Jason Gunthorpe
2019-09-02  7:58           ` Christoph Hellwig
2019-09-02 10:49             ` Jason Gunthorpe
2019-08-28 14:19 ` Christoph Hellwig [this message]
2019-08-28 15:07 ` cleanup the walk_page_range interface v2 Jason Gunthorpe
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08 15:42 cleanup the walk_page_range interface Christoph Hellwig
2019-08-08 15:42 ` [PATCH 3/3] pagewalk: use lockdep_assert_held for locking validation Christoph Hellwig
2019-08-08 18:18   ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190828141955.22210-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=jgg@mellanox.com \
    --cc=jglisse@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=steven.price@arm.com \
    --cc=thellstrom@vmware.com \
    --cc=thomas@shipmail.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.