On Thu, Mar 07, 2024 at 09:41:17AM -0500, Zi Yan wrote: > On 7 Mar 2024, at 9:31, Dan Carpenter wrote: > > > On Thu, Mar 07, 2024 at 09:20:09AM -0500, Zi Yan wrote: > >> > >> Can you check if the patch below fixes the issue? I checked the inputs from > >> debugfs and also inside split_huge_page_to_list_to_order(). > >> > >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c > >> index a81a09236c16..4d21e57a7d07 100644 > >> --- a/mm/huge_memory.c > >> +++ b/mm/huge_memory.c > >> @@ -3052,6 +3052,9 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, > >> VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); > >> VM_BUG_ON_FOLIO(!folio_test_large(folio), folio); > >> > >> + if (new_order >= folio_order(folio)) > >> + return -EINVAL; > >> + > >> /* Cannot split anonymous THP to order-1 */ > >> if (new_order == 1 && folio_test_anon(folio)) { > >> VM_WARN_ONCE(1, "Cannot split to order-1 folio"); > > > > From a static analysis perspective I think just this is sufficient? But > > I don't really know the code and don't object to the other parts of > > this path either. > > You are right. The other two changes are in debugfs to avoid unnecessary > folio locking operations. They are more like an optimization. Fantastic. Thanks! regards, dan carpenter