From: Thomas Prescher via B4 Relay <devnull+thomas.prescher.cyberus-technology.de@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>,
Muchun Song <muchun.song@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org,
Thomas Prescher <thomas.prescher@cyberus-technology.de>
Subject: [PATCH 2/2] mm: hugetlb: log time needed to allocate hugepages
Date: Fri, 21 Feb 2025 14:49:04 +0100 [thread overview]
Message-ID: <20250221-hugepage-parameter-v1-2-fa49a77c87c8@cyberus-technology.de> (raw)
In-Reply-To: <20250221-hugepage-parameter-v1-0-fa49a77c87c8@cyberus-technology.de>
From: Thomas Prescher <thomas.prescher@cyberus-technology.de>
Having this information allows users to easily tune
the hugepages_node_threads parameter.
Signed-off-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
---
mm/hugetlb.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index b7d24c41e0f9d22f5b86c253e29a2eca28460026..2aa5724a385494f9d6f1d644a2bfe547591fc96c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3428,6 +3428,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;
@@ -3450,7 +3453,13 @@ static unsigned long __init hugetlb_pages_alloc_boot(struct hstate *h)
*/
job.max_threads = num_node_state(N_MEMORY) * allocation_threads_per_node;
job.min_chunk = h->max_huge_pages / num_node_state(N_MEMORY) / allocation_threads_per_node;
+
+ jiffies_start = jiffies;
padata_do_multithreaded(&job);
+ jiffies_end = jiffies;
+
+ printk(KERN_DEBUG "HugeTLB: allocation took %dms\n",
+ jiffies_to_msecs(jiffies_end - jiffies_start));
return h->nr_huge_pages;
}
--
2.48.1
prev parent reply other threads:[~2025-02-21 13:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 13:49 [PATCH 0/2] Add a command line option that enables control of how many threads per NUMA node should be used to allocate huge pages Thomas Prescher via B4 Relay
2025-02-21 13:49 ` [PATCH 1/2] mm: hugetlb: add hugetlb_alloc_threads cmdline option Thomas Prescher via B4 Relay
2025-02-21 13:52 ` Matthew Wilcox
2025-02-21 14:16 ` Thomas Prescher
2025-02-23 2:46 ` Andrew Morton
2025-02-24 10:42 ` Thomas Prescher
2025-02-24 17:37 ` Frank van der Linden
2025-02-25 13:01 ` Thomas Prescher
2025-02-21 13:49 ` Thomas Prescher via B4 Relay [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250221-hugepage-parameter-v1-2-fa49a77c87c8@cyberus-technology.de \
--to=devnull+thomas.prescher.cyberus-technology.de@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=thomas.prescher@cyberus-technology.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox