The quilt patch titled Subject: mm: use get_oder() and check size is is_power_of_2 has been removed from the -mm tree. Its filename was mm-override-mthp-enabled-defaults-at-kernel-cmdline-fix.patch This patch was dropped because it was folded into mm-override-mthp-enabled-defaults-at-kernel-cmdline.patch ------------------------------------------------------ From: Barry Song <v-songbaohua@xxxxxxxx> Subject: mm: use get_oder() and check size is is_power_of_2 Date: Thu, 15 Aug 2024 10:34:16 +1200 Using get_order() is more robust according to Baolin. It is also better to filter illegal size such as 3KB, 16KB according to David. Link: https://lkml.kernel.org/r/20240814224635.43272-1-21cnbao@xxxxxxxxx Signed-off-by: Barry Song <v-songbaohua@xxxxxxxx> Suggested-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> Suggested-by: David Hildenbrand <david@xxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Lance Yang <ioworker0@xxxxxxxxx> Cc: Ryan Roberts <ryan.roberts@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/huge_memory.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/mm/huge_memory.c~mm-override-mthp-enabled-defaults-at-kernel-cmdline-fix +++ a/mm/huge_memory.c @@ -929,14 +929,17 @@ static inline int get_order_from_str(con int order; size = memparse(size_str, &endptr); - order = fls(size >> PAGE_SHIFT) - 1; - if ((1 << order) & ~THP_ORDERS_ALL_ANON) { - pr_err("invalid size %s(order %d) in thp_anon boot parameter\n", - size_str, order); - return -EINVAL; - } + + if (!is_power_of_2(size >> PAGE_SHIFT)) + goto err; + order = get_order(size); + if ((1 << order) & ~THP_ORDERS_ALL_ANON) + goto err; return order; +err: + pr_err("invalid size %s in thp_anon boot parameter\n", size_str); + return -EINVAL; } static char str_dup[PAGE_SIZE] __meminitdata; _ Patches currently in -mm which might be from v-songbaohua@xxxxxxxx are mm-extend-usage-parameter-so-that-cluster_swap_free_nr-can-be-reused.patch mm-swap-add-nr-argument-in-swapcache_prepare-and-swapcache_clear-to-support-large-folios.patch mm-override-mthp-enabled-defaults-at-kernel-cmdline.patch mm-rename-instances-of-swap_info_struct-to-meaningful-si.patch mm-attempt-to-batch-free-swap-entries-for-zap_pte_range.patch mm-attempt-to-batch-free-swap-entries-for-zap_pte_range-fix.patch mm-count-the-number-of-anonymous-thps-per-size.patch mm-count-the-number-of-partially-mapped-anonymous-thps-per-size.patch mm-add-nr-argument-in-mem_cgroup_swapin_uncharge_swap-helper-to-support-large-folios.patch mm-document-__gfp_nofail-must-be-blockable.patch mm-warn-about-illegal-__gfp_nofail-usage-in-a-more-appropriate-location-and-manner.patch