From patchwork Fri Dec 8 02:56:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang Li X-Patchwork-Id: 175543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5212589vqy; Thu, 7 Dec 2023 19:06:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfzAWMAH9PjGrtQaKUZ2VVHgoK56afm76UfU4XoAkT2coX4FsmI/9oapu/3EQKoOdIOJz4 X-Received: by 2002:a05:6a00:150c:b0:6ce:6cae:c262 with SMTP id q12-20020a056a00150c00b006ce6caec262mr4622661pfu.11.1702004808658; 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 Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id o21-20020a634e55000000b005c693ea6618si705427pgl.523.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 AC9D28069438; Thu, 7 Dec 2023 19:06:37 -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 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=ham 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:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784681394187013272 X-GMAIL-MSGID: 1784681394187013272 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: