Skip to content

Commit 70478a5

Browse files
tpressureakpm00
authored andcommitted
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>
1 parent 71f7456 commit 70478a5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mm/hugetlb.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3608,6 +3608,9 @@ static unsigned long __init hugetlb_pages_alloc_boot(struct hstate *h)
36083608
.numa_aware = true
36093609
};
36103610

3611+
unsigned long jiffies_start;
3612+
unsigned long jiffies_end;
3613+
36113614
job.thread_fn = hugetlb_pages_alloc_boot_node;
36123615
job.start = 0;
36133616
job.size = h->max_huge_pages;
@@ -3635,7 +3638,14 @@ static unsigned long __init hugetlb_pages_alloc_boot(struct hstate *h)
36353638

36363639
job.max_threads = hugepage_allocation_threads;
36373640
job.min_chunk = h->max_huge_pages / hugepage_allocation_threads;
3641+
3642+
jiffies_start = jiffies;
36383643
padata_do_multithreaded(&job);
3644+
jiffies_end = jiffies;
3645+
3646+
pr_info("HugeTLB: allocation took %dms with hugepage_allocation_threads=%ld\n",
3647+
jiffies_to_msecs(jiffies_end - jiffies_start),
3648+
hugepage_allocation_threads);
36393649

36403650
return h->nr_huge_pages;
36413651
}

0 commit comments

Comments
 (0)