From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 18:17:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 81DA0D8B; Fri, 8 Mar 2013 18:17:38 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) by mx1.freebsd.org (Postfix) with ESMTP id 333D2C2C; Fri, 8 Mar 2013 18:17:37 +0000 (UTC) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.14.5/8.14.5) with SMTP id r28BYs8u029991; Fri, 8 Mar 2013 12:17:36 -0600 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp1.rice.edu with ESMTP id 1axwq1geg2-1; Fri, 08 Mar 2013 12:17:36 -0600 Received: from mh2.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh2.mail.rice.edu (Postfix) with ESMTP id 80C205001AD; Fri, 8 Mar 2013 12:17:36 -0600 (CST) Received: from mh2.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh2.mail.rice.edu (Postfix) with ESMTP id 7F4D1500110; Fri, 8 Mar 2013 12:17:36 -0600 (CST) X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from mh2.mail.rice.edu ([127.0.0.1]) by mh2.mail.rice.edu (mh2.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id WugWxzyevXTX; Fri, 8 Mar 2013 12:17:36 -0600 (CST) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id 052775001AB; Fri, 8 Mar 2013 12:17:35 -0600 (CST) Message-ID: <513A2B3E.2070804@rice.edu> Date: Fri, 08 Mar 2013 12:17:34 -0600 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130127 Thunderbird/17.0.2 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r248031 - in head/sys: kern sys References: <201303081014.r28AEwet053196@svn.freebsd.org> In-Reply-To: <201303081014.r28AEwet053196@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5400 definitions=5800 signatures=585085 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=4 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1111160001 definitions=main-1101130121 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 18:17:38 -0000 On 03/08/2013 04:14, Andre Oppermann wrote: > Author: andre > Date: Fri Mar 8 10:14:58 2013 > New Revision: 248031 > URL: http://svnweb.freebsd.org/changeset/base/248031 > > Log: > Move the auto-sizing of the callout array from init_param2() to > kern_timeout_callwheel_alloc() where it is actually used. > > This is a mechanical move and no tuning parameters are changed. > > The pre-allocated callout array is only used for legacy timeout(9) > calls and is only allocated and active on cpu0. Eventually all > remaining users of timeout(9) should switch to the callout_* API. > In the meantime, until all legacy timeout(9) users are updated, I think that it would be wise to retain the comment that describes where the magic number 18508 comes from. Regards, Alan > Reviewed by: davide > > Modified: > head/sys/kern/kern_timeout.c > head/sys/kern/subr_param.c > head/sys/sys/callout.h > > Modified: head/sys/kern/kern_timeout.c > ============================================================================== > --- head/sys/kern/kern_timeout.c Fri Mar 8 08:19:50 2013 (r248030) > +++ head/sys/kern/kern_timeout.c Fri Mar 8 10:14:58 2013 (r248031) > @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -101,6 +102,11 @@ SYSCTL_INT(_debug, OID_AUTO, to_avg_mpca > 0, "Average number of MP direct callouts made per callout_process call. " > "Units = 1/1000"); > #endif > + > +static int ncallout; > +SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0, > + "Number of entries in callwheel and size of timeout() preallocation"); > + > /* > * TODO: > * allocate more timeout table slots when table overflows. > @@ -252,6 +258,14 @@ kern_timeout_callwheel_alloc(caddr_t v) > > timeout_cpu = PCPU_GET(cpuid); > cc = CC_CPU(timeout_cpu); > + > + /* > + * Calculate the size of the callout wheel and the preallocated > + * timeout() structures. > + */ > + 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'. > > Modified: head/sys/kern/subr_param.c > ============================================================================== > --- head/sys/kern/subr_param.c Fri Mar 8 08:19:50 2013 (r248030) > +++ head/sys/kern/subr_param.c Fri Mar 8 10:14:58 2013 (r248031) > @@ -91,7 +91,6 @@ int maxprocperuid; /* max # of procs p > int maxfiles; /* sys. wide open files limit */ > int maxfilesperproc; /* per-proc open files limit */ > int msgbufsize; /* size of kernel message buffer */ > -int ncallout; /* maximum # of timer events */ > int nbuf; > int ngroups_max; /* max # groups per process */ > int nswbuf; > @@ -109,8 +108,6 @@ u_long sgrowsiz; /* amount to grow sta > > SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN, &hz, 0, > "Number of clock ticks per second"); > -SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0, > - "Number of pre-allocated timer events"); > SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN, &nbuf, 0, > "Number of buffers in the buffer cache"); > SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0, > @@ -327,15 +324,6 @@ init_param2(long physpages) > TUNABLE_INT_FETCH("kern.nbuf", &nbuf); > > /* > - * XXX: Does the callout wheel have to be so big? > - * > - * Clip callout to result of previous function of maxusers maximum > - * 384. This is still huge, but acceptable. > - */ > - ncallout = imin(16 + maxproc + maxfiles, 18508); > - TUNABLE_INT_FETCH("kern.ncallout", &ncallout); > - > - /* > * The default for maxpipekva is min(1/64 of the kernel address space, > * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. > */ > > Modified: head/sys/sys/callout.h > ============================================================================== > --- head/sys/sys/callout.h Fri Mar 8 08:19:50 2013 (r248030) > +++ head/sys/sys/callout.h Fri Mar 8 10:14:58 2013 (r248031) > @@ -63,8 +63,6 @@ struct callout_handle { > }; > > #ifdef _KERNEL > -extern int ncallout; > - > #define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE) > #define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE) > #define callout_drain(c) _callout_stop_safe(c, 1) >