From patchwork Thu Nov 23 13:30:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang Li X-Patchwork-Id: 168934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp450506vqx; Thu, 23 Nov 2023 05:37:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGQX8gF0+ptR/lRJKJ0SoL1+RN40R4qRwgGQu1A9ppF6OPsdkFVi/lNdvyEBgNPTZ0MJ+G X-Received: by 2002:a05:6a20:8e28:b0:187:449d:a4cd with SMTP id y40-20020a056a208e2800b00187449da4cdmr3234326pzj.27.1700746636764; Thu, 23 Nov 2023 05:37:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700746636; cv=none; d=google.com; s=arc-20160816; b=F3o1Y9FqN/sD8jWPyVot6k+RWFHJM/qr997wICrIMWAht/I2eFXQCBchTo8pQaS6ix oNCrYTg0+M6U9U0r/zuyg7RTkivOAuFADcbjnln29XsVXhWsd5m+MJHRJF86yfZHQZNa jzhgT/j1iJ1t+5UoZ8/E5rNBmAylPsS+9o5UVFTkBW5nA9v67lrldI2+dawBYAV4PodU lq/17R+u1A20uQHyw1skDgc5PBz8/5aEvnWsSYqRvZZv/TSZIhrB+HH0sQs4wPtB3fvn mkSp7lwZWqIrjGYUNfxqCpvpsrCUp6flURYDeDDnG+nJkQcvRDC06WlUUf29Q8OJtnLV 65/g== 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=ZmVKGX3xWVsiaI1L9mmzJOcNAtj7qPzayoGRggtSBII=; fh=Mfp6tXIfhm0wKwJBfrCMEq/ET4PmqmqmqGe1ZOy3t1A=; b=XyiHQ9mRUDCI1g+pdrLOHeVakBq4EIRXt5Fh4713csiTzCJmBUwo/y3bn5TL8uJx/x VTHvu07FQTr8UDWgdYMApnKzBE3GY/0BNlfDdn6UySBfgY9zwR9+1/HxWJjawNkRchYU uR3FEjycNQgi94O+ad/CkesBvYmuVw4fz4Tt8f62R7zurg/VrCNri/TC8cWC4Z715iPR XUOXTGBOlHs7p/1ntQbYYPQ90ybc7cd5H+aNSgIhf8KP+5a0wjl036yPpkG7lNT8VxWB GaXTnmpfltvdVEIUpxhFh6/k2sEiVFqIU8tLgzaxQYPcTwNAq8oleH3tBUeDurty+IuV 3Wow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Ztzwn0HQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id j6-20020a056a00130600b006cb4c6074c8si1249338pfu.311.2023.11.23.05.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 05:37:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Ztzwn0HQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 120938329A28; Thu, 23 Nov 2023 05:37:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345557AbjKWNgj (ORCPT + 99 others); Thu, 23 Nov 2023 08:36:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345504AbjKWNg0 (ORCPT ); Thu, 23 Nov 2023 08:36:26 -0500 Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [IPv6:2001:41d0:1004:224b::af]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAABD1B3 for ; Thu, 23 Nov 2023 05:36:31 -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=1700746272; 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=ZmVKGX3xWVsiaI1L9mmzJOcNAtj7qPzayoGRggtSBII=; b=Ztzwn0HQtIgdF3nrfOjRTmuus6uH05VuvO5saXWr5t12Q51VOnt0v0Tdqe3fTgV29LfEAj ZlpS/GGfT1xwjVdXl9k5LFCEe038RDKIRwdprffhWUuffvY73PgEemYmViGVybE5iBDRMn 6grrj48RxSO/qOyc0/yPWH8AYNiUtwQ= From: Gang Li To: Mike Kravetz , Muchun Song , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Gang Li Subject: [RFC PATCH v1 3/4] hugetlb: add timing to hugetlb allocations on boot Date: Thu, 23 Nov 2023 21:30:35 +0800 Message-Id: <20231123133036.68540-4-gang.li@linux.dev> In-Reply-To: <20231123133036.68540-1-gang.li@linux.dev> References: <20231123133036.68540-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=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Thu, 23 Nov 2023 05:37:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783362105266948423 X-GMAIL-MSGID: 1783362105266948423 From: Gang Li Add timing to hugetlb allocations for further optimization. Signed-off-by: Gang Li --- mm/hugetlb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 7f9ff0855dd0..ac8558724cc2 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3563,7 +3563,7 @@ static unsigned long __init hugetlb_hstate_alloc_pages_non_gigantic(struct hstat */ static void __init hugetlb_hstate_alloc_pages(struct hstate *h) { - unsigned long allocated; + unsigned long allocated, start; /* skip gigantic hugepages allocation if hugetlb_cma enabled */ if (hstate_is_gigantic(h) && hugetlb_cma_size) { @@ -3576,11 +3576,13 @@ static void __init hugetlb_hstate_alloc_pages(struct hstate *h) return; /* below will do all node balanced alloc */ + start = jiffies; if (!hstate_is_gigantic(h)) { allocated = hugetlb_hstate_alloc_pages_non_gigantic(h); } else { allocated = hugetlb_hstate_alloc_pages_gigantic(h); } + pr_info("HugeTLB: Allocation takes %u ms\n", jiffies_to_msecs(jiffies - start)); hugetlb_hstate_alloc_pages_report(allocated, h); }