Date: Thu, 20 Jul 2017 08:59:26 +0200 From: Sebastian Huber <sebastian.huber@embedded-brains.de> To: FreeBSD <freebsd-hackers@freebsd.org> Subject: Relationship between ncallout and callwheelsize Message-ID: <8ba43394-41e4-f06c-a8c6-12b773d185c4@embedded-brains.de>
next in thread | raw e-mail | index | archive | help
Hello,
I noticed on a LPC4088 running at 96MHz from external SDRAM that the
callout_process() function needs a lot of time even if no callouts are
active. The reason is that on a 32-bit architecture with only 13 general
purpose registers this function needs a lot of load/store operations. So
I tried to reduce the complexity by using compile time constants. I
don't understand why the callwheelsize and the timeout(9)
pre-allocations are related:
ncallout = imin(16 + maxproc + maxfiles, 18508);
TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
/*
* Calculate callout wheel size, should be next power of two higher
* than 'ncallout'.
*/
callwheelsize = 1 << fls(ncallout);
callwheelmask = callwheelsize - 1;
The size of the wheel should be related to typical timeout values to
balance memory size and hash collisions. Why is there a connection to
the timeout(9) pre-allocations?
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8ba43394-41e4-f06c-a8c6-12b773d185c4>
