Thread (1 message) 1 message, 1 author, 2014-12-08

[PATCH] mm:add VM_BUG_ON() for page_mapcount()

From: Wang, Yalin <hidden>
Date: 2014-12-08 09:51:19
Also in: linux-mm, lkml

-----Original Message-----
From: Hillf Danton [mailto:hillf.zj at alibaba-inc.com]
Sent: Monday, December 08, 2014 5:33 PM
To: Wang, Yalin
Cc: linux-kernel; linux-mm at kvack.org; linux-arm-kernel at lists.infradead.org;
Andrew Morton; Hillf Danton
Subject: Re: [PATCH] mm:add VM_BUG_ON() for page_mapcount()
quoted
This patch add VM_BUG_ON() for slab page, because _mapcount is an
union with slab struct in struct page, avoid access _mapcount if this
page is a slab page.
Also remove the unneeded bracket.

Signed-off-by: Yalin Wang <redacted>
---
 include/linux/mm.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h index
11b65cf..34124c4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -373,7 +373,8 @@ static inline void reset_page_mapcount(struct page
*page)

 static inline int page_mapcount(struct page *page)  {
-	return atomic_read(&(page)->_mapcount) + 1;
+	VM_BUG_ON(PageSlab(page));
s/ VM_BUG_ON/ VM_BUG_ON_PAGE/ ?
Yes, I will send again .
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help