Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7044650ybh; Thu, 8 Aug 2019 09:21:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQ3EiA+Q8rDlR2T1WNFO7ss7O1RZRWiChyJcOkMef056bsGaKLUqbnG8hEhGzTmZdttvOE X-Received: by 2002:a63:fc52:: with SMTP id r18mr13444249pgk.378.1565281318127; Thu, 08 Aug 2019 09:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565281318; cv=none; d=google.com; s=arc-20160816; b=j4ROlKDIiFHOz1T/BiWrOTg/OLnVi2nxbtyG/5aWh041bDIB+Vx/bc/3ymr0qcqOSf MZQSYDJAMEwjvwGdsHWTgk3kED4giWnkaI2VQ0+qekPcdmg0ZRuQP/quuBni+codJGJl /mHdrLD68NDWI6myxnkRKBHAAwkQ1oqqGri1hDzjUgLhNY4JwTRbc7HxY6PwdLZE/QVV tk4YDTVC7ZbayLDdMPYQX9iwLPTf3DCj8pbGnVfEsLyB+rstBljQu43hnNsMSJTli4tC Fl3HqNyc13u1TFBcXoZJd+fb5y68uIXDuNZlQAyAQI+b2qenZP2Ac7SZUqorSEQa1gJt wI6w== 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=qoYaUeTX6kw3ANFQpuUtmmKlzLoKmX03PXm3Ah6Uf/k=; b=O9AN3gQqv0TrJr0braNpRizF+vhPP7DDMcGcUxxm4mgiOEMU0SpduSzB+qnMysXvUr 4BEtEBdSLckyv+fgM67CvlKoxm/vWskxnGR3imeMwyWGLWsPr9LpBtRD2XaJb+y8AS2j py4GxvSr6WC9eBJWS8niIvTD9ZS1x8bO6Lqxk0dFZxe+emEh8JQt1/HI6h2r0iGzyrZx qPXaUsuUeLplnphN1g1cjkgb2Btsh3PcuHg/Os5GFaF6BxZE1/5xakd06sDTYVCYR1ge Z69rPBKSAKOyqfp1W7opuK31Q4K9m4gBRM9hzkJCTE4BHajuojPLsCfQEGxE/w6WHFoO Kc6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=C8WU+shx; 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 j1si54644467pgb.482.2019.08.08.09.21.42; Thu, 08 Aug 2019 09:21:58 -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=C8WU+shx; 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 S2390146AbfHHPm4 (ORCPT + 99 others); Thu, 8 Aug 2019 11:42:56 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51634 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390136AbfHHPmz (ORCPT ); Thu, 8 Aug 2019 11:42:55 -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=qoYaUeTX6kw3ANFQpuUtmmKlzLoKmX03PXm3Ah6Uf/k=; b=C8WU+shxCqtJgFK4W6BVr72MB4 iqFJN4NcAE8VQCLTnWdSOTVjPgbU+yGpNkh3/1SYrjyHGc/dOcepyoxjMsjFakuzNs7fR3+c8ZgZ7 s+P/mhbtZPHz1buQd4VQxo9vp4So9TcFHvNecibB59+tmPvBkrmhP7o+merNfhTzJy0xFUS0Box6t SiUSG909IQyiE9Z3NBipjp1FH82pFfvw4EJBFxqxwBjNq0rYllcA9o+dmcX3AOfMFla7sCFN03x0u KGv0FNiNyq3iTXP6OhQRnVk7JRNCaAn5QVUOjR96C6/nXuFik+y/b+rmpg62AgATdN3XakZhmJOqs LFoIdkVA==; Received: from [195.167.85.94] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hvkZ0-0008VE-O8; Thu, 08 Aug 2019 15:42:51 +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 Subject: [PATCH 3/3] pagewalk: use lockdep_assert_held for locking validation Date: Thu, 8 Aug 2019 18:42:40 +0300 Message-Id: <20190808154240.9384-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190808154240.9384-1-hch@lst.de> References: <20190808154240.9384-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 --- mm/pagewalk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 28510fc0dde1..9ec1885ceed7 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -319,7 +319,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 { @@ -369,7 +369,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