summaryrefslogtreecommitdiff
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-10-03 18:06:48 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-10-03 18:06:48 +0000
commit2ac906315dd2935ea86fb46830b78578fe07851b (patch)
tree29367cb99b032e740f641ca24a38b2ee662bdccc /sys/kern/init_main.c
parent6783cb575f3a29041f69ca189b28b9a59427df68 (diff)
Introduce a thread for zeroing pages without holding the kernel lock. This
way we can do some useful kernel lock in parallel with other things and create a reservoir of zeroed pages ready for use elsewhere. This should reduce latency. The thread runs at the absolutel lowest priority such that we don't keep other kernel threads or userland from doing useful work. Can be easily disabled by disabling the kthread_create(9) call in main(). Which perhaps we should do for non-MP kernels. ok deraadt@, tedu@
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 82641c7adaf..b2922581365 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.217 2014/08/14 09:01:47 mpi Exp $ */
+/* $OpenBSD: init_main.c,v 1.218 2014/10/03 18:06:46 kettenis Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -526,6 +526,10 @@ main(void *framep)
if (kthread_create(uvm_aiodone_daemon, NULL, NULL, "aiodoned"))
panic("fork aiodoned");
+ /* Create the page zeroing kernel thread. */
+ if (kthread_create(uvm_pagezero_thread, NULL, NULL, "zerothread"))
+ panic("fork zerothread");
+
#if defined(MULTIPROCESSOR)
/* Boot the secondary processors. */
cpu_boot_secondary_processors();