Date: Thu, 20 Dec 2012 12:13:42 +0100 From: =?ISO-8859-1?Q?Bernhard_Fr=F6hlich?= <decke@bluelife.at> To: Andriy Gapon <avg@freebsd.org> Cc: freebsd-emulation@freebsd.org, vbox@freebsd.org Subject: Re: issue with under-tick waits Message-ID: <CAE-m3X1V1Obi4UMVOTr%2BmeoNMXHv3WNvRa9N9XUtxCXsW-47xg@mail.gmail.com> In-Reply-To: <50C9D27C.1090707@FreeBSD.org> References: <50C9D27C.1090707@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 13, 2012 at 2:05 PM, Andriy Gapon <avg@freebsd.org> wrote: > > I think that the following patch is needed in VirtualBox 4.2.4 kernel mod= ule: > > --- sleepqueue-r0drv-freebsd.h.orig 2012-12-12 20:09:29.675203802 +02= 00 > +++ sleepqueue-r0drv-freebsd.h 2012-12-12 20:11:53.604203131 +0200 > @@ -82,6 +82,8 @@ > uint64_t cTicks =3D ASMMultU64ByU32DivByU32(uTimeout, hz, UINT32_C(1= 000000000)); > if (cTicks >=3D INT_MAX) > return RTSEMWAIT_FLAGS_INDEFINITE; > + else if (cTicks =3D=3D 0 && uTimeout > 0) > + pWait->iTimeout =3D 1; > else > pWait->iTimeout =3D (int)cTicks; > #endif > > Without this patch any waits for periods shorter than a single tick retur= n > immediately leading to a lot of unnecessary spinning. For example, I obs= erve that > my guest's idle loop does a lot of sleeps with periods slightly shorter t= han 1 ms > (1/hz), e.g. 900us. All that waiting turns into pure spinning and Virtua= lBox eats > 100% of a core. > The above patch improves the situation significantly. Also, it (approxim= ately) > follows what tvtohz does. Thanks a lot! I've added the patch to the port. https://github.com/decke/freebsd-vbox/commit/102a18dbfd8a0a668f7042e6d086b9= d0df25e20f --=20 Bernhard Fr=F6hlich http://www.bluelife.at/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-m3X1V1Obi4UMVOTr%2BmeoNMXHv3WNvRa9N9XUtxCXsW-47xg>