linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: rmap: use VM_BUG_ON() in __page_check_anon_rmap()
@ 2019-11-05 17:03 Yang Shi
  2019-11-06  8:28 ` Kirill A. Shutemov
  0 siblings, 1 reply; 3+ messages in thread
From: Yang Shi @ 2019-11-05 17:03 UTC (permalink / raw)
  To: 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().

Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
---
 mm/rmap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index d17cbf3..39178eb 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,8 @@ 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_anon_vma(page)->root != vma->anon_vma->root);
+	VM_BUG_ON(page_to_pgoff(page) != linear_page_index(vma, address));
 }
 
 /**
-- 
1.8.3.1


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

end of thread, other threads:[~2019-11-06 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 17:03 [PATCH] mm: rmap: use VM_BUG_ON() in __page_check_anon_rmap() Yang Shi
2019-11-06  8:28 ` Kirill A. Shutemov
2019-11-06 17:42   ` Yang Shi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).