[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <35FD53F367049845BC99AC72306C23D103E688B313F5@CNBJMBX05.corpusers.net>
Date: Mon, 8 Dec 2014 15:47:47 +0800
From: "Wang, Yalin" <Yalin.Wang@...ymobile.com>
To: "'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
"'linux-mm@...ck.org'" <linux-mm@...ck.org>,
"'linux-arm-kernel@...ts.infradead.org'"
<linux-arm-kernel@...ts.infradead.org>,
"'akpm@...ux-foundation.org'" <akpm@...ux-foundation.org>,
"'riel@...hat.com'" <riel@...hat.com>,
"'nasa4836@...il.com'" <nasa4836@...il.com>,
"'sasha.levin@...cle.com'" <sasha.levin@...cle.com>
Subject: [PATCH] mm:add VM_BUG_ON() for page_mapcount()
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 <yalin.wang@...ymobile.com>
---
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));
+ return atomic_read(&page->_mapcount) + 1;
}
static inline int page_count(struct page *page)
--
2.1.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists