From 40b287054521f0a92e5ae9a26e6a87d17ee85eea Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Fri, 19 May 2023 06:46:42 -0700 Subject: [PATCH] mi_startup: Instrument the bubblesort with TSLOG The bubblesort of SYSINITs is currently responsible for 7% of the kernel boot time when booting a 1 CPU / 128 MB VM under Firecracker. It needs to be replaced with a faster sort, but until that happens at least instrumenting it with TSLOG makes it show up in flamecharts. --- sys/kern/init_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 1974c4e68ce..e4cb501bc57 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -255,6 +255,7 @@ restart: * Perform a bubble sort of the system initialization objects by * their subsystem (primary key) and order (secondary key). */ + TSENTER2("bubblesort"); for (sipp = sysinit; sipp < sysinit_end; sipp++) { for (xipp = sipp + 1; xipp < sysinit_end; xipp++) { if ((*sipp)->subsystem < (*xipp)->subsystem || @@ -266,6 +267,7 @@ restart: *xipp = save; } } + TSEXIT2("bubblesort"); last = SI_SUB_COPYRIGHT; #if defined(VERBOSE_SYSINIT)