Date: Tue, 15 Oct 2024 17:41:35 +0900 From: Tomoaki AOKI <junchoon@dec.sakura.ne.jp> To: void <void@f-m.fm> Cc: freebsd-hackers@freebsd.org Subject: Re: polling interval Message-ID: <20241015174135.14866b319a49ddafeca6e3bb@dec.sakura.ne.jp> In-Reply-To: <Zw2xTp3RH5fhlBib@int21h> References: <Zw0Ez-zyTg9oodi8@int21h> <20241015000117.8a731ab66a1af876879f5ca8@dec.sakura.ne.jp> <Zw1WKr6uVYiHEPi0@int21h> <9513c9d9-8f7c-4842-a535-b387082e4e3e@sentex.net> <Zw2xTp3RH5fhlBib@int21h>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 15 Oct 2024 01:03:26 +0100 void <void@f-m.fm> wrote: > On Mon, Oct 14, 2024 at 03:32:52PM -0400, mike tancsa wrote: > > >Did adjusting it make any difference ? > > I set it to maximum, rebooted but the vm wouldnt come up > fully lol, so made another one. kern.hz dedines how frequently the forced task (process) switch happens. The fewer the value is, the faster the process runs (lower overhead) with the cost of lower responsiveness. OTOH, the higher kern.hz is, the more chance to responding for user interaction, with the cost of total performance loss (higher overhead). These are because how much instructions could be run on single tick (process/context switching) is affected with this. And this also affects kernel, not only userland. And of course, affected by IPC and clock freq of CPU cores and memory (including caches) bandwidth, too. This means, setting too high value causes kernel to not finishing needed-finishing-in-1-tick operations. Maybe your vm kernel thread would be in this state. > I'm going to try adjusting it in small increments to see if i can get the > virtio-net performance on freebsd guests to be as quick or nearly as quick as > linux ones in bhyve. > -- This tunable is defined as SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &hz, 0, "Number of clock ticks per second"); SYSCTL_INT(_kern, OID_AUTO, hz_max, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, HZ_MAXIMUM, "Maximum hz value supported"); SYSCTL_INT(_kern, OID_AUTO, hz_min, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, HZ_MINIMUM, "Minimum hz value supported"); in sys/kern/subr_param.c with related definitions and includes. In this file, HZ is dedaulted as 1000 if not defined in other place or make command line. Initially variable hz is set to -1, fetch for tunable kern.hz, if none, hz = vm_guest > VM_GUEST_NO ? HZ_VM : HZ; is applied. IIRC, in ancient days, default kern_hz (HZ) was 100 and bumped to 1000 (current default) at some point. So trying around 10000 or 5000 and if not satisfactory, try increasing or decreasing would be nice for recent amd64 hardwares. (It depends, though.) FYI, I'm configuring kern.hz=4096 in /boot/loader.conf. Lost where I've seen, but recommended by somewhere. -- Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20241015174135.14866b319a49ddafeca6e3bb>