Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: sanity-check maximum folio size in folio_set_order()

Let's sanity-check in folio_set_order() whether we would be trying to
create a folio with an order that would make it exceed MAX_FOLIO_ORDER.

This will enable the check whenever a folio/compound page is initialized
through prepare_compound_head() / prepare_compound_page() with
CONFIG_DEBUG_VM set.

Link: https://lkml.kernel.org/r/20250901150359.867252-11-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand and committed by
Andrew Morton
99132d24 50765b46

+1
+1
mm/internal.h
··· 755 755 { 756 756 if (WARN_ON_ONCE(!order || !folio_test_large(folio))) 757 757 return; 758 + VM_WARN_ON_ONCE(order > MAX_FOLIO_ORDER); 758 759 759 760 folio->_flags_1 = (folio->_flags_1 & ~0xffUL) | order; 760 761 #ifdef NR_PAGES_IN_LARGE_FOLIO