From owner-freebsd-hackers@freebsd.org Thu Jul 20 07:25:36 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5718CDAABCA for ; Thu, 20 Jul 2017 07:25:36 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 143A983E41 for ; Thu, 20 Jul 2017 07:25:35 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from [88.198.220.132] (helo=sslproxy03.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1dY5Qr-0007AQ-7o for freebsd-hackers@freebsd.org; Thu, 20 Jul 2017 08:59:33 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy03.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dY5Qp-0008Tp-4l for freebsd-hackers@freebsd.org; Thu, 20 Jul 2017 08:59:31 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id CC07F2A004F for ; Thu, 20 Jul 2017 08:59:31 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id s3TZ4NIRLdUj for ; Thu, 20 Jul 2017 08:59:28 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id CEB282A160A for ; Thu, 20 Jul 2017 08:59:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id XvxEASNxxbL8 for ; Thu, 20 Jul 2017 08:59:28 +0200 (CEST) Received: from [192.168.96.129] (unknown [192.168.96.129]) by mail.embedded-brains.de (Postfix) with ESMTPSA id AEC5A2A004F for ; Thu, 20 Jul 2017 08:59:28 +0200 (CEST) To: FreeBSD From: Sebastian Huber Subject: Relationship between ncallout and callwheelsize Message-ID: <8ba43394-41e4-f06c-a8c6-12b773d185c4@embedded-brains.de> Date: Thu, 20 Jul 2017 08:59:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.99.2/23579/Thu Jul 20 02:14:56 2017) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jul 2017 07:25:36 -0000 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= .