mm: prepare page_referenced() and page_idle to new THP refcounting
Both page_referenced() and page_idle_clear_pte_refs_one() assume that THP can only be mapped with PMD, so there's no reason to look on PTEs for PageTransHuge() pages. That's no true anymore: THP can be mapped with PTEs too. The patch removes PageTransHuge() test from the functions and opencode page table check. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Vladimir Davydov <vdavydov@parallels.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
e90309c9f7
commit
b20ce5e03b
@@ -433,21 +433,26 @@ static inline void page_mapcount_reset(struct page *page)
|
||||
atomic_set(&(page)->_mapcount, -1);
|
||||
}
|
||||
|
||||
int __page_mapcount(struct page *page);
|
||||
|
||||
static inline int page_mapcount(struct page *page)
|
||||
{
|
||||
int ret;
|
||||
VM_BUG_ON_PAGE(PageSlab(page), page);
|
||||
|
||||
ret = atomic_read(&page->_mapcount) + 1;
|
||||
if (PageCompound(page)) {
|
||||
page = compound_head(page);
|
||||
ret += atomic_read(compound_mapcount_ptr(page)) + 1;
|
||||
if (PageDoubleMap(page))
|
||||
ret--;
|
||||
}
|
||||
return ret;
|
||||
if (unlikely(PageCompound(page)))
|
||||
return __page_mapcount(page);
|
||||
return atomic_read(&page->_mapcount) + 1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
int total_mapcount(struct page *page);
|
||||
#else
|
||||
static inline int total_mapcount(struct page *page)
|
||||
{
|
||||
return page_mapcount(page);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int page_count(struct page *page)
|
||||
{
|
||||
return atomic_read(&compound_head(page)->_count);
|
||||
|
Reference in New Issue
Block a user