summaryrefslogtreecommitdiff
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorThomas Prescher <thomas.prescher@cyberus-technology.de>2025-02-27 23:45:07 +0100
committerAndrew Morton <akpm@linux-foundation.org>2025-03-17 00:05:37 -0700
commit70478a5534af757f9bbc65bbb25b607bd0e69890 (patch)
treeac8e9c35d993fd548943485e5f2dc6f51bc7c6a8 /mm/hugetlb.c
parent71f745688985c59eee41ffe88497a9e62774a9bf (diff)
mm: hugetlb: log time needed to allocate hugepages
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>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 486365cb2ece..7a47a08e8526 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3608,6 +3608,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;
@@ -3635,7 +3638,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;
}