Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2087605rdb; Thu, 7 Dec 2023 19:06:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFk0DPIB6ShLOkUZPM6gFW2IM3qASbgEy/Bq7yAJB7AGnOgRRRL1PMfTp1glMNR76sipleX X-Received: by 2002:a17:90b:1650:b0:286:bd26:b5ab with SMTP id il16-20020a17090b165000b00286bd26b5abmr3728852pjb.6.1702004808829; Thu, 07 Dec 2023 19:06:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702004808; cv=none; d=google.com; s=arc-20160816; b=WvRNmAg0/AszgeHOpMpGP6amX99qgZ2y/6ouDtStAyrIiQ3Q7rqNvQvUBFZ9kUnN4F Vqzk1zgq8FZ22QnKBzOrkucEaH2+Q9Dwt6OAGK4qgBeLGm2Gsbng88IvlwOJWZoUKjXK DyJOhmiLGXSCTabXdx9vmM+/913SZtqkiWgP1SeHwaSYx6vGCx8M55/YvB6afCvMgiUH 3KJwcmfgfiEWzF5LsVd6taEscFF9yQUo65tnY6PAhDN/AySv9LqIlVKHI+np2b3SJJ7R /VOGhqEG27TJ9BRt1FSQM2BF4EzmyKVcgNopB0cGvT6lvbWF1lYS0xkTIJlsVSbMFNfA i9Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Pp4e2f1m5xzOKYlTpY9BWRD9Si0GcTtJwwlQEj1BdUw=; fh=Pa5q92hwVm9te/76xY9OBp9q92f42px/5UQJ67cl80c=; b=r5zpj+fFSAToLUNj989aa8r1ZtfHc+kX24Q0JADyOjx2dethICCCo5rxSU8B2pAX6a TL3Nw5Jt21O55sy/hCEHIO44xIvvYL69UYZqugYEEtIGbZMa19DjmBwB5q/cmcZOKHNr XvalLnDa+Zh5AMzW2yd3bYcKt34kWwrfSgCEAyFgqmMRUEWBnSU15ctRlXMe69iVmT5/ ICZdugh+rwvS4bTBUjsJEivLz+bF17xZJ3HdMdzfoebbjBMh8gK3CNK9+WusAT8d/alW N8z5N1u4+vJ6V4fvAyG5zFPba2hi6oV3bFkTZEpbeWsY77DEe1hhEeuQXY18HLYVXDqv iyrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="xCPbD/P/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id r6-20020a17090a560600b00286b854b672si2138423pjf.157.2023.12.07.19.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 19:06:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="xCPbD/P/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BB376809988D; Thu, 7 Dec 2023 19:06:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235374AbjLHDG2 (ORCPT + 99 others); Thu, 7 Dec 2023 22:06:28 -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: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 07 Dec 2023 19:06:42 -0800 (PST) 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; BUILD_BUG_ON(sizeof_field(struct page, private) * BITS_PER_BYTE < __NR_HPAGEFLAGS); @@ -4536,8 +4537,11 @@ static int __init hugetlb_init(void) } hugetlb_cma_check(); + start = 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(); hugetlb_sysfs_init(); @@ -4682,6 +4686,7 @@ static int __init hugepages_setup(char *s) } } + unsigned long start = 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) last_mhp = mhp; + pr_info("HugeTLB: 1G alloc takes %u ms\n", jiffies_to_msecs(jiffies - start)); return 1; invalid: -- 2.30.2