[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-emulation
Subject:    Re: issue with under-tick waits
From:       Bernhard_Fröhlich <decke () bluelife ! at>
Date:       2012-12-20 11:13:42
Message-ID: CAE-m3X1V1Obi4UMVOTr+meoNMXHv3WNvRa9N9XUtxCXsW-47xg () mail ! gmail ! com
[Download RAW message or body]

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 module:
>
> --- sleepqueue-r0drv-freebsd.h.orig     2012-12-12 20:09:29.675203802 +0200
> +++ sleepqueue-r0drv-freebsd.h  2012-12-12 20:11:53.604203131 +0200
> @@ -82,6 +82,8 @@
>      uint64_t cTicks = ASMMultU64ByU32DivByU32(uTimeout, hz, UINT32_C(1000000000));
>      if (cTicks >= INT_MAX)
>          return RTSEMWAIT_FLAGS_INDEFINITE;
> +    else if (cTicks == 0 && uTimeout > 0)
> +        pWait->iTimeout     = 1;
>      else
>          pWait->iTimeout     = (int)cTicks;
>  #endif
>
> Without this patch any waits for periods shorter than a single tick return
> immediately leading to a lot of unnecessary spinning.  For example, I observe that
> my guest's idle loop does a lot of sleeps with periods slightly shorter than 1 ms
> (1/hz), e.g. 900us.  All that waiting turns into pure spinning and VirtualBox eats
> 100% of a core.
> The above patch improves the situation significantly.  Also, it (approximately)
> follows what tvtohz does.

Thanks a lot! I've added the patch to the port.

https://github.com/decke/freebsd-vbox/commit/102a18dbfd8a0a668f7042e6d086b9d0df25e20f

-- 
Bernhard Fröhlich
http://www.bluelife.at/
_______________________________________________
freebsd-emulation@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-emulation
To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic