[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231208025617.5299-1-gang.li@linux.dev>
Date: Fri, 8 Dec 2023 10:56:17 +0800
From: Gang Li <gang.li@...ux.dev>
To: David Rientjes <rientjes@...gle.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
ligang.bdlg@...edance.com, Gang Li <gang.li@...ux.dev>
Subject: [PATCH 1/1] hugetlb: add timing to hugetlb allocations on boot
Add timing to hugetlb allocations for further optimization.
Debug only.
Signed-off-by: Gang Li <gang.li@...ux.dev>
---
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
Powered by blists - more mailing lists