]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: hugetlb: log time needed to allocate hugepages
authorThomas Prescher <thomas.prescher@cyberus-technology.de>
Thu, 27 Feb 2025 22:45:07 +0000 (23:45 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 4 Mar 2025 05:50:53 +0000 (21:50 -0800)
Having this information allows users to easily tune the
hugepages_node_threads parameter.

Link: https://lkml.kernel.org/r/20250227-hugepage-parameter-v2-3-7db8c6dc0453@cyberus-technology.de
Signed-off-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c

index 7a43aaad27599996b2f405a6d22455f2b772be64..c7a2205fd50536b9c7ec1a4424c2871130e7c152 100644 (file)
@@ -3603,6 +3603,9 @@ static unsigned long __init hugetlb_pages_alloc_boot(struct hstate *h)
                .numa_aware     = true
        };
 
+       unsigned long jiffies_start;
+       unsigned long jiffies_end;
+
        job.thread_fn   = hugetlb_pages_alloc_boot_node;
        job.start       = 0;
        job.size        = h->max_huge_pages;
@@ -3630,7 +3633,14 @@ static unsigned long __init hugetlb_pages_alloc_boot(struct hstate *h)
 
        job.max_threads = hugepage_allocation_threads;
        job.min_chunk   = h->max_huge_pages / hugepage_allocation_threads;
+
+       jiffies_start = jiffies;
        padata_do_multithreaded(&job);
+       jiffies_end = jiffies;
+
+       pr_info("HugeTLB: allocation took %dms with hugepage_allocation_threads=%ld\n",
+               jiffies_to_msecs(jiffies_end - jiffies_start),
+               hugepage_allocation_threads);
 
        return h->nr_huge_pages;
 }