"Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> writes: > Current split_huge_page() combines two operations: splitting PMDs into > tables of PTEs and splitting underlying compound page. This patch > changes split_huge_pmd() implementation to split the given PMD without > splitting other PMDs this page mapped with or underlying compound page. > > In order to do this we have to get rid of tail page refcounting, which > uses _mapcount of tail pages. Tail page refcounting is needed to be able > to split THP page at any point: we always know which of tail pages is > pinned (i.e. by get_user_pages()) and can distribute page count > correctly. > > We can avoid this by allowing split_huge_page() to fail if the compound > page is pinned. This patch removes all infrastructure for tail page > refcounting and make split_huge_page() to always return -EBUSY. All > split_huge_page() users already know how to handle its fail. Proper > implementation will be added later. > > Without tail page refcounting, implementation of split_huge_pmd() is > pretty straight-forward. > > Memory cgroup is not yet ready for new refcouting. Let's disable it on > Kconfig level. > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> ..... ..... > static inline int page_mapped(struct page *page) > { > - return atomic_read(&(page)->_mapcount) + compound_mapcount(page) >= 0; > + int i; > + if (likely(!PageCompound(page))) > + return atomic_read(&page->_mapcount) >= 0; > + if (compound_mapcount(page)) > + return 1; > + for (i = 0; i < hpage_nr_pages(page); i++) { > + if (atomic_read(&page[i]._mapcount) >= 0) > + return 1; > + } do we need to loop with head page here ? ie, page = compound_page(page); > + return 0; > } -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>