Linux-mm Archive on lore.kernel.org
 help / color / Atom feed
* [v2 PATCH] mm: rmap: use VM_BUG_ON_PAGE() in __page_check_anon_rmap()
@ 2019-11-07 20:09 Yang Shi
  2019-11-11  8:54 ` Kirill A. Shutemov
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Shi @ 2019-11-07 20:09 UTC (permalink / raw)
  To: kirill.shutemov, akpm; +Cc: yang.shi, linux-mm, linux-kernel

The __page_check_anon_rmap() just calls two BUG_ON()s protected by
CONFIG_DEBUG_VM, the #ifdef could be eliminated by using VM_BUG_ON_PAGE().

Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
---
v2: Use VM_BUG_ON_PAGE() per Kirill and update the subject accordingly.

 mm/rmap.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index d17cbf3..71d58d6 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1055,7 +1055,6 @@ static void __page_set_anon_rmap(struct page *page,
 static void __page_check_anon_rmap(struct page *page,
 	struct vm_area_struct *vma, unsigned long address)
 {
-#ifdef CONFIG_DEBUG_VM
 	/*
 	 * The page's anon-rmap details (mapping and index) are guaranteed to
 	 * be set up correctly at this point.
@@ -1068,9 +1067,9 @@ static void __page_check_anon_rmap(struct page *page,
 	 * are initially only visible via the pagetables, and the pte is locked
 	 * over the call to page_add_new_anon_rmap.
 	 */
-	BUG_ON(page_anon_vma(page)->root != vma->anon_vma->root);
-	BUG_ON(page_to_pgoff(page) != linear_page_index(vma, address));
-#endif
+	VM_BUG_ON_PAGE(page_anon_vma(page)->root != vma->anon_vma->root, page);
+	VM_BUG_ON_PAGE(page_to_pgoff(page) != linear_page_index(vma, address),
+		       page);
 }
 
 /**
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [v2 PATCH] mm: rmap: use VM_BUG_ON_PAGE() in __page_check_anon_rmap()
  2019-11-07 20:09 [v2 PATCH] mm: rmap: use VM_BUG_ON_PAGE() in __page_check_anon_rmap() Yang Shi
@ 2019-11-11  8:54 ` Kirill A. Shutemov
  0 siblings, 0 replies; 2+ messages in thread
From: Kirill A. Shutemov @ 2019-11-11  8:54 UTC (permalink / raw)
  To: Yang Shi; +Cc: kirill.shutemov, akpm, linux-mm, linux-kernel

On Fri, Nov 08, 2019 at 04:09:06AM +0800, Yang Shi wrote:
> The __page_check_anon_rmap() just calls two BUG_ON()s protected by
> CONFIG_DEBUG_VM, the #ifdef could be eliminated by using VM_BUG_ON_PAGE().
> 
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
-- 
 Kirill A. Shutemov


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 20:09 [v2 PATCH] mm: rmap: use VM_BUG_ON_PAGE() in __page_check_anon_rmap() Yang Shi
2019-11-11  8:54 ` Kirill A. Shutemov

Linux-mm Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
		linux-mm@kvack.org
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kvack.linux-mm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git