[PATCH 1/1] hugetlb: add timing to hugetlb allocations on boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add timing to hugetlb allocations for further optimization.

Debug only.

Signed-off-by: Gang Li <gang.li@xxxxxxxxx>
---
 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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux