From patchwork Fri Feb 21 13:49:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Prescher via B4 Relay X-Patchwork-Id: 13985533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 869F6C021B5 for ; Fri, 21 Feb 2025 13:49:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5ADE28000C; Fri, 21 Feb 2025 08:49:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C92C228000B; Fri, 21 Feb 2025 08:49:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8CA628000A; Fri, 21 Feb 2025 08:49:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9AEDA280001 for ; Fri, 21 Feb 2025 08:49:10 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 356D61A0F83 for ; Fri, 21 Feb 2025 13:49:10 +0000 (UTC) X-FDA: 83144083260.19.2B5B848 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf28.hostedemail.com (Postfix) with ESMTP id 5CF6FC0005 for ; Fri, 21 Feb 2025 13:49:08 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rYI3ZRvD; spf=pass (imf28.hostedemail.com: domain of devnull+thomas.prescher.cyberus-technology.de@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=devnull+thomas.prescher.cyberus-technology.de@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740145748; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cKJfKW6R6vHVKn6FJdBR85CowhRbrIieMMwMzY9KXZo=; b=SJpbWnltsfCUx900wcp2PD9ti193etRKdDwmGE4YhuAyicxZ4KquFWtpUifLWCHlXEx9qJ AVVAFHHsaDLGvxsn7DOi/r669ONIA4ujtLlJj0UcZ9yVPP7WXKjbFG2nDDHWxp1p1SjisN UC4BvRXW6qJIVnDIM3N3UHzLe+XfOeQ= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rYI3ZRvD; spf=pass (imf28.hostedemail.com: domain of devnull+thomas.prescher.cyberus-technology.de@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=devnull+thomas.prescher.cyberus-technology.de@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740145748; a=rsa-sha256; cv=none; b=xq4o+tijWQom//ga6iPl22WsUrKqkZFk4iHXK2wwFCMuNi74sbk87gqiNsjLuet/WsxL5Q 7Z8e8QaB3Nr7ZEfKBZVdaXHdqvyNZilEn3tX7LhzE0r50XI25W+UAo7zAzTtfFUwBfGXKJ GZpDAHXkqX2gFSzMaB/eve9tzldY5NA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 3F4606132C; Fri, 21 Feb 2025 13:49:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 38DBEC4CEE7; Fri, 21 Feb 2025 13:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740145747; bh=0iNsPS01vP3ua/6DjsJ/YHAG8fnILRNzO8D3XnR9sKM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=rYI3ZRvDUX+tFgklGKPOFhZeNIEWYQOmxFK0i8jyJVlttLadz4q8TFQuTxYwi8UEY 4aFQiTtrZLYyuPsrc2ZxMYngNko4UY0OezSibUX5IP8ui4rJHLHJaxg51ZdGhoVg1d Kxv+nRtYgxtGyJnydcFjcIgqg5dCfuVEggx0WGW1xPkpqn1tS9ik31Gvw45sBDKCCJ JSnJsndZpTAjXVRLREmIDnYBDPZ92F6rUZBL3PVvcXgzTNeB028MyjUhkzlAVRo285 g4QEpDdOq5GwkLdBcSWJ160/lKzQew2+2E0J0vfu0KMHHVEXeeVy/clvKSq5IgHHC/ UG32FdCY1Q9yQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2812DC021B5; Fri, 21 Feb 2025 13:49:07 +0000 (UTC) From: Thomas Prescher via B4 Relay Date: Fri, 21 Feb 2025 14:49:03 +0100 Subject: [PATCH 1/2] mm: hugetlb: add hugetlb_alloc_threads cmdline option MIME-Version: 1.0 Message-Id: <20250221-hugepage-parameter-v1-1-fa49a77c87c8@cyberus-technology.de> References: <20250221-hugepage-parameter-v1-0-fa49a77c87c8@cyberus-technology.de> In-Reply-To: <20250221-hugepage-parameter-v1-0-fa49a77c87c8@cyberus-technology.de> To: Jonathan Corbet , Muchun Song , Andrew Morton Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Thomas Prescher X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740145745; l=6157; i=thomas.prescher@cyberus-technology.de; s=20250221; h=from:subject:message-id; bh=HpOhYCnQyPIjVEHgimpeR6bfXmBvvCC82GS66+KuNpc=; b=c6Khcn66ph6MIR62Cg3BtSzEpppedB0VFMShAA2aJRKUTNalEouvy7dv7m1IBSaM/Wo7P8KVA MJBKaB/iE83CE21NyCBi/qnj0i5DkkRq0TdT43fSmJsI7nFbHnPzQcm X-Developer-Key: i=thomas.prescher@cyberus-technology.de; a=ed25519; pk=T5MVdLVCc/0UUyv5IcSqGVvGcVkgWW/KtuEo2RRJwM8= X-Endpoint-Received: by B4 Relay for thomas.prescher@cyberus-technology.de/20250221 with auth_id=345 X-Original-From: Thomas Prescher Reply-To: thomas.prescher@cyberus-technology.de X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 5CF6FC0005 X-Stat-Signature: 7wn6rgf6z4swkacjmem8bt8jtdw1qpd7 X-HE-Tag: 1740145748-520566 X-HE-Meta: U2FsdGVkX1/C++wbFjjgQfRsdkqSpMBdyKDXkJkSOZmnPzNr0YBfUvdcfoIq1OSEcp1OyslnxFkg6wrILRSpF+8VrjHn4wd6ol7YjLahfFM0sCG/UtQ4s5XgXaFXynthVxvPY+23T+y/zDRqZiJOWzvKC6I/LtseBZ6GFFG+z/YOW36YsC1yBN2tYyAcdaIuP5YXVsnCa7xRxozwVdwLGN1K2/Ue6c0upPdeNwGLnmO5WtMqC9iQ8+NNL2ODse2EniBUnQfkifFH5dcv1oWCd9B2/AAVKUwcvaewVDc9p2X2/KDKkWByr9anxYXcjHQDJOTXNJvk80DHYjnA9ltVFo9HFT+6fvoobvMrsNBCSTT7g+Gm87BJtMTWRcWUUeMwal5yvHN3weU59RBOhuX0IUDFGVoIOLMklvpVjhjpHN89T5JlGQQmF/DDvHYNz8jDlVQ/NPlTm+V3f/F8p8SJD7x+DN0BPA6PCd0P6lXWV0mhfL/kxhrv1tpy46VwSITttEks6lxfyKaPnfu5plc7PJ0dS62sOVn2do8Y3lqHHFX0HTWWWRJDvRK8PCmtnmV280/WEwDS9VbqwW8xjysAtsbgRma0KxzVxrGhukEF+4Oh0i6T2P6GC2wUA5MfvQxfGjAm9ZQGBo3WmsrkUUaKLREm87A4rf8mPFcjuTh5eJYHL6AfQbXYvC/MyWynbldsT5mqoWnPj35rG5UQ8OleneiCSNzg+3rWMVFcrSJl/2CM8y29VXNqFzo0I3L16SWbVKMCi2ngqX4REppmIXUyTsdkNGks59WZcsBSPFH9Aqm9ujmYm6H2glze2se0FcWRofsRRkm8V+6XDGHKckn0KCzrkcSerRpyoJys9VFh5nAcjcq/09reTK4DhZ1sy7N92m6T4XJlcFE5cWFcZjmsPZCei7STRDPXaHkVTUdBm9oMcrJaYG0W6tuTs8N4yGKBcNxPy1tFiS4683gg9R5 BdD472Oa 2r5unLMBpcuy/pGjv28RjrERO/NSrjscPBx46QKItrJj8vcfZLPQREW+2I68o5mMPGZXo9jmd9J0pizMzEUgdJh8+cwXSoSb9bYmgVSPO/YhxTmmkbglFe8R6z7YyLa2D9HINZ5AZdtDpEatLG6doP5js6Cr/A9slybyJlJdMi/i8VCJWf2cCef0WuCsc3JtAbBDS7nZm8TT2cdNhTCrk2mwehW+d/yOyWcL9zmEsMDeUrIzC5etr8Yd4LS0UoQ3KXB2cn2QU/0quhreaxHOoBR0NDsH4CJTYdmHEShgRNRE9NNca3v7guE1wp7zfQErgJAc5yap5sDe2Ix2/0oZRQ6QfoAAAlxKBo4DNuSC52YK6x6dcOD5zwumWtqEfaN5ZfDiqJ4BCir2y9Rx3+h5eROiM80S6woYddCFHHVN5EfBX53B71GLK35BLblgiaOLpP21L X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Thomas Prescher Add a command line option that enables control of how many threads per NUMA node should be used to allocate huge pages. Allocating huge pages can take a very long time on servers with terabytes of memory even when they are allocated at boot time where the allocation happens in parallel. The kernel currently uses a hard coded value of 2 threads per NUMA node for these allocations. This patch allows to override this value. Signed-off-by: Thomas Prescher --- Documentation/admin-guide/kernel-parameters.txt | 7 ++++ Documentation/admin-guide/mm/hugetlbpage.rst | 9 ++++- mm/hugetlb.c | 50 +++++++++++++++++-------- 3 files changed, 49 insertions(+), 17 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index fb8752b42ec8582b8750d7e014c4d76166fa2fc1..812064542fdb0a5c0ff7587aaaba8da81dc234a9 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1882,6 +1882,13 @@ Documentation/admin-guide/mm/hugetlbpage.rst. Format: size[KMG] + hugepage_alloc_threads= + [HW] The number of threads per NUMA node that should + be used to allocate hugepages during boot. + This option can be used to improve system bootup time + when allocating a large amount of huge pages. + The default value is 2 threads per NUMA node. + hugetlb_cma= [HW,CMA,EARLY] The size of a CMA area used for allocation of gigantic hugepages. Or using node format, the size of a CMA area per node can be specified. diff --git a/Documentation/admin-guide/mm/hugetlbpage.rst b/Documentation/admin-guide/mm/hugetlbpage.rst index f34a0d798d5b533f30add99a34f66ba4e1c496a3..c88461be0f66887d532ac4ef20e3a61dfd396be7 100644 --- a/Documentation/admin-guide/mm/hugetlbpage.rst +++ b/Documentation/admin-guide/mm/hugetlbpage.rst @@ -145,7 +145,14 @@ hugepages It will allocate 1 2M hugepage on node0 and 2 2M hugepages on node1. If the node number is invalid, the parameter will be ignored. - +hugepage_alloc_threads + Specify the number of threads per NUMA node that should be used to + allocate hugepages during boot. This parameter can be used to improve + system bootup time when allocating a large amount of huge pages. + The default value is 2 threads per NUMA node. Example to use 8 threads + per NUMA node:: + + hugepage_alloc_threads=8 default_hugepagesz Specify the default huge page size. This parameter can only be specified once on the command line. default_hugepagesz can diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 163190e89ea16450026496c020b544877db147d1..b7d24c41e0f9d22f5b86c253e29a2eca28460026 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -68,6 +68,7 @@ static unsigned long __initdata default_hstate_max_huge_pages; static bool __initdata parsed_valid_hugepagesz = true; static bool __initdata parsed_default_hugepagesz; static unsigned int default_hugepages_in_node[MAX_NUMNODES] __initdata; +static unsigned long allocation_threads_per_node __initdata = 2; /* * Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages, @@ -3432,26 +3433,23 @@ static unsigned long __init hugetlb_pages_alloc_boot(struct hstate *h) job.size = h->max_huge_pages; /* - * job.max_threads is twice the num_node_state(N_MEMORY), + * job.max_threads is twice the num_node_state(N_MEMORY) by default. * - * Tests below indicate that a multiplier of 2 significantly improves - * performance, and although larger values also provide improvements, - * the gains are marginal. + * On large servers with terabytes of memory, huge page allocation + * can consume a considerably amount of time. * - * Therefore, choosing 2 as the multiplier strikes a good balance between - * enhancing parallel processing capabilities and maintaining efficient - * resource management. + * Tests below show how long it takes to allocate 1 TiB of memory with 2MiB huge pages. + * 2MiB huge pages. Using more threads can significantly improve allocation time. * - * +------------+-------+-------+-------+-------+-------+ - * | multiplier | 1 | 2 | 3 | 4 | 5 | - * +------------+-------+-------+-------+-------+-------+ - * | 256G 2node | 358ms | 215ms | 157ms | 134ms | 126ms | - * | 2T 4node | 979ms | 679ms | 543ms | 489ms | 481ms | - * | 50G 2node | 71ms | 44ms | 37ms | 30ms | 31ms | - * +------------+-------+-------+-------+-------+-------+ + * +--------------------+-------+-------+-------+-------+-------+ + * | threads per node | 2 | 4 | 8 | 16 | 32 | + * +--------------------+-------+-------+-------+-------+-------+ + * | skylake 4node | 44s | 22s | 16s | 19s | 20s | + * | cascade lake 4node | 39s | 20s | 11s | 10s | 9s | + * +--------------------+-------+-------+-------+-------+-------+ */ - job.max_threads = num_node_state(N_MEMORY) * 2; - job.min_chunk = h->max_huge_pages / num_node_state(N_MEMORY) / 2; + 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; padata_do_multithreaded(&job); return h->nr_huge_pages; @@ -4764,6 +4762,26 @@ static int __init default_hugepagesz_setup(char *s) } __setup("default_hugepagesz=", default_hugepagesz_setup); +/* hugepage_alloc_threads command line parsing + * When set, use this specific number of threads per NUMA node for the boot + * allocation of hugepages. + */ +static int __init hugepage_alloc_threads_setup(char *s) +{ + unsigned long threads_per_node; + + if (kstrtoul(s, 0, &threads_per_node) != 0) + return 1; + + if (threads_per_node == 0) + return 1; + + allocation_threads_per_node = threads_per_node; + + return 1; +} +__setup("hugepage_alloc_threads=", hugepage_alloc_threads_setup); + static unsigned int allowed_mems_nr(struct hstate *h) { int node; From patchwork Fri Feb 21 13:49:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Prescher via B4 Relay X-Patchwork-Id: 13985535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0003C021B6 for ; Fri, 21 Feb 2025 13:49:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 45EA9280001; Fri, 21 Feb 2025 08:49:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2805628000B; Fri, 21 Feb 2025 08:49:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E67C2280004; Fri, 21 Feb 2025 08:49:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BBC31280001 for ; Fri, 21 Feb 2025 08:49:10 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 40E07141068 for ; Fri, 21 Feb 2025 13:49:10 +0000 (UTC) X-FDA: 83144083260.11.24B6AE5 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf29.hostedemail.com (Postfix) with ESMTP id 4A0A7120007 for ; Fri, 21 Feb 2025 13:49:08 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=beyYBABR; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of devnull+thomas.prescher.cyberus-technology.de@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=devnull+thomas.prescher.cyberus-technology.de@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740145748; a=rsa-sha256; cv=none; b=eHqDfOf6tw7b4zHvU0twbqdOguW12ZX4gRsXlGOjsmUzykB/Ir5q4+HRmbZx3r+ef/MdjX D98gJdQYeT92JRewzvagBSMTVoxUk+wlPh6BSc0XsF4j4LKUHmlop5E3m8nKPDkdkHB1W+ CqRobblCS3mhDw6N5Bqx4pkYMQkFj1s= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=beyYBABR; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of devnull+thomas.prescher.cyberus-technology.de@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=devnull+thomas.prescher.cyberus-technology.de@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740145748; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1xoCZlV2ZuwpLx35amKKnW4mG8A7+vqQaE52i5RgCow=; b=CXybPLeyjaonFaGU9kJjMvJDtFRHwMAj4m71TmWCo93vXfOQsOsT0a0hD6RBkCZ4ZmuU+A pr8OczNpRFA0dMzL3uQ/np6WjK9O2NRETvBjhTfxlmzX8sHjw29T9Kjbl5oLVETs56LZJK JOj5iCU41meHy+6n8F9on4n9Nm+Ra8g= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 493696132E; Fri, 21 Feb 2025 13:49:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 456D3C4CEE8; Fri, 21 Feb 2025 13:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740145747; bh=C0EAePF53lIXFleUHeMPzsteLlLG26sy4F3rDVZs/WI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=beyYBABRNIJEUcIKdaE6ZUxIcbBE06xl56SR6bwRLYN12s/eGS5U1gZSVYnQsEDDN ZHPBzLi8KKjGDwfcXlfc/Dz5VFnVR2c7Z3p5awl4nXLv8aTc+7ViX4SLjsQnJEBM6g JTLYLDtIIZSG4JhI5tAtYma+AlAy2UDkUy3tBs1a77OHFm+KeEnoOte/dNblrSGj27 d4PVZQT0BfiHYzwWUnDJkLjHUY3ukqbDdrtgI4rtvR0TbVE7DNAksTPb5By2xxDMVc b9AijH8Kg5o3GgWu6y6sEG3AmVQq/mBq1H6u+H1D5xHLRwPwy53ImwsM1okMXEWrfq 5l4/SYly93MxQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36038C021B6; Fri, 21 Feb 2025 13:49:07 +0000 (UTC) From: Thomas Prescher via B4 Relay Date: Fri, 21 Feb 2025 14:49:04 +0100 Subject: [PATCH 2/2] mm: hugetlb: log time needed to allocate hugepages MIME-Version: 1.0 Message-Id: <20250221-hugepage-parameter-v1-2-fa49a77c87c8@cyberus-technology.de> References: <20250221-hugepage-parameter-v1-0-fa49a77c87c8@cyberus-technology.de> In-Reply-To: <20250221-hugepage-parameter-v1-0-fa49a77c87c8@cyberus-technology.de> To: Jonathan Corbet , Muchun Song , Andrew Morton Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Thomas Prescher X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1740145745; l=1236; i=thomas.prescher@cyberus-technology.de; s=20250221; h=from:subject:message-id; bh=+RVZ6u1nzdp1931lwTDAnLSee61rdleZduyoY/lMDIA=; b=4+fAS5E5X1tj0juCLlk8wApea1Mw0hFQMhgVoxUvNua6eliTe5IqQoAihZ6t8J1ZOqKoXwCkS PyHzdDBHY34C9m3qRY5CD7zL8gr1jDVg1stVn8oZoDsw6CVRLFkgv8z X-Developer-Key: i=thomas.prescher@cyberus-technology.de; a=ed25519; pk=T5MVdLVCc/0UUyv5IcSqGVvGcVkgWW/KtuEo2RRJwM8= X-Endpoint-Received: by B4 Relay for thomas.prescher@cyberus-technology.de/20250221 with auth_id=345 X-Original-From: Thomas Prescher Reply-To: thomas.prescher@cyberus-technology.de X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 4A0A7120007 X-Stat-Signature: 4md7jxihwgiyxk4kewoh1wrg4zftof6q X-Rspam-User: X-HE-Tag: 1740145748-907273 X-HE-Meta: U2FsdGVkX1+wMLzXB3Z0A20XXUNQxRgkRqAZItRa/hkX82tOt3CHFkj9GHuDzoap0G29rvHGXM9kPiEQmPJrkQtdWndglnqiWhxC+CcozIE0a8NFvCP2y0RCm+5EGbpzQ0at+y4O4yRQml4kI4VvURLsXUrCYL7n6bsjyTJ04SnQV0XqJCxzzWSXYCk+5D7/fKk8BkryeRqtR3fQI+mcRwckO/0hVCqUrTpPDjEFYbQVKUsFd5kbRAKaDhR70Hz7JHFq8pJR0rfhN9Y6jjhQY6IRlTQPPgaWD9qMoZavdYN7rmq7ZUxPiZoGHTPR/HCYUqvMxSCDQ7cncA2sbnlvkXsuV8SR6pU9oyCU/9gnCQjiTO1jQ/bu7ShzxhX7KTxielm4D2CeIzeE95vlAyW1uRJ/xTuCic9xEMm/v8tdYNanVOHFHiZB1omP7ot79oEtjhx9CxId7fkQE5otTNv6CwIBLIKqP1omhQF4PWm6TUyLiVf0Jj7aCgE4Uaj6JlnrpSyfyh2NTGt+orB11MrZRiRakVRm5HJG2G4MsDC2W51K29Kkx/6+i5usyAhmo5PLpYB+CuwW/floGdogQPmylZF0mfhLQHFgyL7rn7ytVGs4DpPwxgSeFuYL5v9ce+F7laJ2nvwNW42wBrYdPzgPDDDZu0T0OF90w+NR9JK25Bz3TAJauftQKj994azx5kACptBiSLFLobcIo47ZxgDoc5K3rckkmfS179f8nZczJgdsx+e8S8mefnDl0AK5rvoA9Gs/6SMxOksgB/L1YujfoA0G5QS/ucDcL/VAKhXsw1iH7npPTY6B75kvX8ikDv8joIQFryvTukdKXu4TDbQ0pAqXRcO/m/rNlIQ5dGzGvxsXSO2nLGm/UKY6J0lVaBq7yvhZf1PdIVeKuR1N9+VHWygL2E951dzK7aFKRLEyDe49xZfXS8X3u4gxJFItVwc7pCUvMO+NA3D2uORhRzD 01mzmY7m NDl0PqTsFak9NtfEMKmWorHxnUu58PXz6SzblarM+36nizqmQwxFMCH2tCACwOOxxSFhXU9IN2Q7Az1ZrLFZJE+MR2YDjgUQTINUgHEIyiAk2uCBQ29agP/hLVNAb78DovXD94hXBa3vbvjUN8yalSDtFlibgIgqrzgFfbYmWlt+TbKiUtkx/U5BOnnjdNrTHZ6CdnmxSNDEqNVzRNjzOHxjzYN2FkMfMZYaTds3zVdQfRzcZIrGAXAGs3Bsd7NR5ifz5dTkI1/6gfwyz3fUKBUw+LmTi17SmH0GsfgSyUnjqJ7rSphQ7mB5igQ1veq/96ajs8paO18lejj1VjyYT54Ow7K2SCnbChvL5KR7S4BFwKSRgySYPTIPvzHYwROc6o63kEBW/XLGiz6k= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000252, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Thomas Prescher Having this information allows users to easily tune the hugepages_node_threads parameter. Signed-off-by: Thomas Prescher --- 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; }