Skip site navigation (1)Skip section navigation (2)
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=20
callout_process() function needs a lot of time even if no callouts are=20
active. The reason is that on a 32-bit architecture with only 13 general=20
purpose registers this function needs a lot of load/store operations. So=20
I tried to reduce the complexity by using compile time constants. I=20
don't understand why the callwheelsize and the timeout(9)=20
pre-allocations are related:

     ncallout =3D 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 =3D 1 << fls(ncallout);
     callwheelmask =3D callwheelsize - 1;

The size of the wheel should be related to typical timeout values to=20
balance memory size and hash collisions. Why is there a connection to=20
the timeout(9) pre-allocations?

--=20
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=C3=A4ftliche 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>