]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm/hugetlb: early exit from hugetlb_pages_alloc_boot() when max_huge_pages=0
authorLi RongQing <lirongqing@baidu.com>
Thu, 14 Aug 2025 10:23:33 +0000 (18:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:23:18 +0000 (16:23 +0200)
commit8f1ca1f373c9e401deb59417deddbc2afbea9a2a
tree0aadde26aa953615a9e1c7bacfb2ac142cb255d6
parent3575087197f0e5cc1a1a9b50af91250559717a8a
mm/hugetlb: early exit from hugetlb_pages_alloc_boot() when max_huge_pages=0

commit b322e88b3d553e85b4e15779491c70022783faa4 upstream.

Optimize hugetlb_pages_alloc_boot() to return immediately when
max_huge_pages is 0, avoiding unnecessary CPU cycles and the below log
message when hugepages aren't configured in the kernel command line.
[    3.702280] HugeTLB: allocation took 0ms with hugepage_allocation_threads=32

Link: https://lkml.kernel.org/r/20250814102333.4428-1-lirongqing@baidu.com
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Tested-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Jane Chu <jane.chu@oracle.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/hugetlb.c