Skip to content

Commit 43357f3

Browse files
kirylsfrothwell
authored andcommitted
mm-prepare-page_referenced-and-page_idle-to-new-thp-refcounting-fix
x86_64 allnoconfig: In file included from mm/rmap.c:47: include/linux/mm.h: In function 'page_referenced': include/linux/mm.h:448: error: call to '__compiletime_assert_448' declared with attribute error: BUILD_BUG failed make[1]: *** [mm/rmap.o] Error 1 make: *** [mm/rmap.o] Error 2 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent b6b615e commit 43357f3

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

include/linux/mm.h

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -433,24 +433,14 @@ static inline int page_mapcount(struct page *page)
433433
return ret;
434434
}
435435

436+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
437+
int total_mapcount(struct page *page);
438+
#else
436439
static inline int total_mapcount(struct page *page)
437440
{
438-
int i, ret;
439-
440-
VM_BUG_ON_PAGE(PageTail(page), page);
441-
442-
if (likely(!PageCompound(page)))
443-
return atomic_read(&page->_mapcount) + 1;
444-
445-
ret = compound_mapcount(page);
446-
if (PageHuge(page))
447-
return ret;
448-
for (i = 0; i < HPAGE_PMD_NR; i++)
449-
ret += atomic_read(&page[i]._mapcount) + 1;
450-
if (PageDoubleMap(page))
451-
ret -= HPAGE_PMD_NR;
452-
return ret;
441+
return page_mapcount(page);
453442
}
443+
#endif
454444

455445
static inline int page_count(struct page *page)
456446
{

mm/huge_memory.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,6 +3204,25 @@ static void __split_huge_page(struct page *page, struct list_head *list)
32043204
}
32053205
}
32063206

3207+
int total_mapcount(struct page *page)
3208+
{
3209+
int i, ret;
3210+
3211+
VM_BUG_ON_PAGE(PageTail(page), page);
3212+
3213+
if (likely(!PageCompound(page)))
3214+
return atomic_read(&page->_mapcount) + 1;
3215+
3216+
ret = compound_mapcount(page);
3217+
if (PageHuge(page))
3218+
return ret;
3219+
for (i = 0; i < HPAGE_PMD_NR; i++)
3220+
ret += atomic_read(&page[i]._mapcount) + 1;
3221+
if (PageDoubleMap(page))
3222+
ret -= HPAGE_PMD_NR;
3223+
return ret;
3224+
}
3225+
32073226
/*
32083227
* This function splits huge page into normal pages. @page can point to any
32093228
* subpage of huge page to split. Split doesn't change the position of @page.

0 commit comments

Comments
 (0)