KSM源码解析之大页函数
文章目录
最近需要修改linux内核代码中ksm部分,所以记录下遇到的一些重要函数,方便以后查阅与理解。
重要函数
PageTransHuge
函数原型:static inline int PageTransHuge(struct page *page)
函数功能: returns true for both transparent huge and hugetlbfs pages, but not normal pages.
PageTransCompound
函数原型: static inline int PageTransCompound(struct page *page)
函数功能: 如果page是透明大页,则返回true
page_trans_compound_anon
函数原型: static struct page * page_trans_compound_anon(struct page *page)
函数代码:
1 | static struct page *page_trans_compound_anon(struct page *page) |
函数功能: *head等于compound_head(page),如果PageAnon(head)则返回head,否则返回NULL
split_huge_page
函数原型: static inline int split_huge_page(struct page *page)
函数功能: splits huge page into normal pages;
Returns 0 if the hugepage is split successfully;
Returns -EBUSY if the page is pinned or if anon_vma disappeared from under us.
page_trans_compound_anon_split
函数原型: static int page_trans_compound_anon_split(struct page *page)
函数代码:
1 | static int page_trans_compound_anon_split(struct page *page) |
函数功能: 拆分复合透明匿名页,若拆分成功返回0,否则返回非0
参考资料: