On Wed, Nov 06, 2024 at 05:06:32PM -0500, Zi Yan wrote: > >> + } else { > >> + if (PageHead(head)) > >> + ClearPageCompound(head); > > > > Huh? You only have to test for PageHead() because it is inside the loop. > > It has to be done after loop is done. > > You are right, will remove this and add the code below after the loop. > > if (!new_order && PageHead(&folio->page)) > ClearPageCompound(&folio->page); PageHead(&forlio->page) is always true, isn't it? > >> + if (folio_test_anon(folio) && folio_test_swapcache(folio)) { > >> + if (!uniform_split) > >> + return -EINVAL; > > > > Why this limitation? > > I am not closely following the status of mTHP support in swap. If it > is supported, this can be removed. Right now, split_huge_page_to_list_to_order() > only allows to split a swapcache folio to order 0[1]. > > [1] https://elixir.bootlin.com/linux/v6.12-rc6/source/mm/huge_memory.c#L3397 It would be nice to clarify this or at least add a comment. -- Kiryl Shutsemau / Kirill A. Shutemov