透明大页的mapcount和refcount
static inline int folio_expected_ref_count(const struct folio *folio)
{
const int order = folio_order(folio);
int ref_count = 0;
/* One reference per page from the swapcache. */
ref_count += folio_test_swapcache(folio) << order;
if (!folio_test_anon(folio)) {
/* One reference per page from the pagecache. */
ref_count += !!folio->mapping << order;
/* One reference from PG_private. */
ref_count += folio_test_private(folio);
}
/* One reference per page table mapping. */
return ref_count + folio_mapcount(folio);
}THP 分配
mTHP 分配
THP 拆分
unmap_folio()
__folio_freeze_and_split_unmapped
remap_folio()
free_folio_and_swap_cache()
lru_add_split_folio()
THP 合并
Last updated