Kirill A. Shutemov wrote: > This patch adds implementation of split_huge_page() for new > refcountings. > > Unlike previous implementation, new split_huge_page() can fail if > somebody holds GUP pin on the page. It also means that pin on page > would prevent it from bening split under you. It makes situation in > many places much cleaner. > > The basic scheme of split_huge_page(): > > - Check that sum of mapcounts of all subpage is equal to page_count() > plus one (caller pin). Foll off with -EBUSY. This way we can avoid > useless PMD-splits. > > - Freeze the page counters by splitting all PMD and setup migration > PTEs. > > - Re-check sum of mapcounts against page_count(). Page's counts are > stable now. -EBUSY if page is pinned. > > - Split compound page. > > - Unfreeze the page by removing migration entries. > > Signed-off-by: Kirill A. Shutemov <[email protected]> > Tested-by: Sasha Levin <[email protected]>
checkpatch fixlet: 749ab1c0df4a thp: reintroduce split_huge_page() fix diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 5df1b76837c7..a200ed579e1f 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2998,7 +2998,7 @@ static void __split_huge_page(struct page *page, struct list_head *list) * Both head page and tail pages will inherit mapping, flags, and so on from * the hugepage. * - * GUP pin and PG_locked transfered to @page. Rest subpages can be freed if + * GUP pin and PG_locked transferred to @page. Rest subpages can be freed if * they are not mapped. * * Returns 0 if the hugepage is split successfully. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

