summaryrefslogtreecommitdiff
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2021-06-02 13:56:29 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2021-06-02 13:56:29 +0000
commit96c18fc50e195cccd4af961f5e76d5924c6743f8 (patch)
tree4333a02973e8b23ed1689d736195f73990847769 /sys/kern/init_main.c
parent7cdc7b221c50a401e09faeaae900640848537ff2 (diff)
Enable pool cache on knote pool
Use the pool cache to reduce the overhead of memory management in function kqueue_register(). When EV_ADD is given, kqueue_register() pre-allocates a knote to avoid potential sleeping in the middle of the critical section that spans from knote lookup to insertion. However, the pre-allocation is useless if the lookup finds a matching knote. The cost of knote allocation will become significant with kqueue-based poll(2) and select(2) because the frequency of allocation will increase. Most of the cost appears to come from the locking inside the pool. The pool cache amortizes it by using CPU-local caches of free knotes as buffers. OK dlg@ mpi@
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 7902f2ea0b6..89d6b9dc577 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.306 2021/02/08 10:51:01 mpi Exp $ */
+/* $OpenBSD: init_main.c,v 1.307 2021/06/02 13:56:28 visa Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -71,6 +71,7 @@
#include <sys/msg.h>
#endif
#include <sys/domain.h>
+#include <sys/event.h>
#include <sys/msgbuf.h>
#include <sys/mbuf.h>
#include <sys/pipe.h>
@@ -148,7 +149,6 @@ void crypto_init(void);
void db_ctf_init(void);
void prof_init(void);
void init_exec(void);
-void kqueue_init(void);
void futex_init(void);
void taskq_init(void);
void timeout_proc_init(void);
@@ -432,7 +432,9 @@ main(void *framep)
prof_init();
#endif
- mbcpuinit(); /* enable per cpu mbuf data */
+ /* Enable per-CPU data. */
+ mbcpuinit();
+ kqueue_init_percpu();
uvm_init_percpu();
/* init exec and emul */