mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 17:54:13 +08:00
mm: add VM_BUG_ON_PAGE() to page_mapcount()
Add VM_BUG_ON_PAGE() for slab pages. _mapcount is an union with slab struct in struct page, so we must avoid accessing _mapcount if this page is a slab page. Also remove the unneeded bracket. Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
e4b294c2d8
commit
1d148e218a
@ -484,7 +484,8 @@ static inline void page_mapcount_reset(struct page *page)
|
||||
|
||||
static inline int page_mapcount(struct page *page)
|
||||
{
|
||||
return atomic_read(&(page)->_mapcount) + 1;
|
||||
VM_BUG_ON_PAGE(PageSlab(page), page);
|
||||
return atomic_read(&page->_mapcount) + 1;
|
||||
}
|
||||
|
||||
static inline int page_count(struct page *page)
|
||||
|
Loading…
Reference in New Issue
Block a user