From nobody Tue Dec 16 18:32:50 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4111DC4167B for ; Fri, 8 Dec 2023 03:06:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573018AbjLHDG3 (ORCPT ); Thu, 7 Dec 2023 22:06:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbjLHDG0 (ORCPT ); Thu, 7 Dec 2023 22:06:26 -0500 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33D8110CA for ; Thu, 7 Dec 2023 19:06:32 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702004191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pp4e2f1m5xzOKYlTpY9BWRD9Si0GcTtJwwlQEj1BdUw=; b=xCPbD/P/C8PYRd/iq7qfzqNK7O0vfM4mGjzdmECDhFGARzzFYf7ZUvm3GJRa/0jylY7zUT N3Cjp/IbGSXRZjSJwSaNafZSlWhPPcdcKRiXSe/Rf6LKUweMgiwkUisLIKD6Z6m69WS41p OKm5SMXqb5fUw2uMJ7ByFbDYnO/E6Mw= From: Gang Li To: David Rientjes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, ligang.bdlg@bytedance.com, Gang Li Subject: [PATCH 1/1] hugetlb: add timing to hugetlb allocations on boot Date: Fri, 8 Dec 2023 10:56:17 +0800 Message-Id: <20231208025617.5299-1-gang.li@linux.dev> In-Reply-To: <20231208025240.4744-1-gang.li@linux.dev> References: <20231208025240.4744-1-gang.li@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add timing to hugetlb allocations for further optimization. Debug only. Signed-off-by: Gang Li --- mm/hugetlb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 1169ef2f2176f..51f50bb3dc092 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4490,6 +4490,7 @@ static inline void hugetlb_sysctl_init(void) { } static int __init hugetlb_init(void) { int i; + unsigned long start; =20 BUILD_BUG_ON(sizeof_field(struct page, private) * BITS_PER_BYTE < __NR_HPAGEFLAGS); @@ -4536,8 +4537,11 @@ static int __init hugetlb_init(void) } =20 hugetlb_cma_check(); + start =3D jiffies; hugetlb_init_hstates(); gather_bootmem_prealloc(); + pr_info("HugeTLB: 2M alloc, init and 1G init takes %u ms\n", + jiffies_to_msecs(jiffies - start)); report_hugepages(); =20 hugetlb_sysfs_init(); @@ -4682,6 +4686,7 @@ static int __init hugepages_setup(char *s) } } =20 + unsigned long start =3D jiffies; /* * Global state is always initialized later in hugetlb_init. * But we need to allocate gigantic hstates here early to still @@ -4692,6 +4697,7 @@ static int __init hugepages_setup(char *s) =20 last_mhp =3D mhp; =20 + pr_info("HugeTLB: 1G alloc takes %u ms\n", jiffies_to_msecs(jiffies - sta= rt)); return 1; =20 invalid: --=20 2.30.2