Skip to content

Commit fdb1227

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 <[email protected]>
1 parent 4e5630e commit fdb1227

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
@@ -448,24 +448,14 @@ static inline int page_mapcount(struct page *page)
448448
return ret;
449449
}
450450

451+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
452+
int total_mapcount(struct page *page);
453+
#else
451454
static inline int total_mapcount(struct page *page)
452455
{
453-
int i, ret;
454-
455-
VM_BUG_ON_PAGE(PageTail(page), page);
456-
457-
if (likely(!PageCompound(page)))
458-
return atomic_read(&page->_mapcount) + 1;
459-
460-
ret = compound_mapcount(page);
461-
if (PageHuge(page))
462-
return ret;
463-
for (i = 0; i < HPAGE_PMD_NR; i++)
464-
ret += atomic_read(&page[i]._mapcount) + 1;
465-
if (PageDoubleMap(page))
466-
ret -= HPAGE_PMD_NR;
467-
return ret;
456+
return page_mapcount(page);
468457
}
458+
#endif
469459

470460
static inline int page_count(struct page *page)
471461
{

mm/huge_memory.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,6 +3216,25 @@ static void __split_huge_page(struct page *page, struct list_head *list)
32163216
}
32173217
}
32183218

3219+
int total_mapcount(struct page *page)
3220+
{
3221+
int i, ret;
3222+
3223+
VM_BUG_ON_PAGE(PageTail(page), page);
3224+
3225+
if (likely(!PageCompound(page)))
3226+
return atomic_read(&page->_mapcount) + 1;
3227+
3228+
ret = compound_mapcount(page);
3229+
if (PageHuge(page))
3230+
return ret;
3231+
for (i = 0; i < HPAGE_PMD_NR; i++)
3232+
ret += atomic_read(&page[i]._mapcount) + 1;
3233+
if (PageDoubleMap(page))
3234+
ret -= HPAGE_PMD_NR;
3235+
return ret;
3236+
}
3237+
32193238
/*
32203239
* This function splits huge page into normal pages. @page can point to any
32213240
* subpage of huge page to split. Split doesn't change the position of @page.

0 commit comments

Comments
 (0)