From owner-freebsd-hackers@FreeBSD.ORG Wed Dec 10 11:21:26 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AADF106564A; Wed, 10 Dec 2008 11:21:26 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 400EA8FC17; Wed, 10 Dec 2008 11:21:26 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 2B3516D44C; Wed, 10 Dec 2008 11:21:25 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 0A1CF844DD; Wed, 10 Dec 2008 12:21:25 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Ivan Voras References: Date: Wed, 10 Dec 2008 12:21:24 +0100 In-Reply-To: (Ivan Voras's message of "Mon, 08 Dec 2008 20:41:32 +0100") Message-ID: <863agws2bv.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: MAXFILES in subr_param.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2008 11:21:26 -0000 Ivan Voras writes: > I'm looking at kern/subr_param.c: > > 72 #ifndef MAXFILES > 73 #define MAXFILES (maxproc * 2) > 74 #endif > > Shouldn't this be at least maxproc*3, for stdin,out,err for every proc? Even maxproc * 3 won't be enough, unless none of your processes actually do anything. It's just an arbitrary value, based on the assumption that you will never have maxproc concurrent processes anyway. > Also, it looks like MAXFILES is used only once, and in a bit funny way: > > 238 maxfiles =3D MAXFILES; > 239 TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); > 240 maxprocperuid =3D (maxproc * 9) / 10; > 241 maxfilesperproc =3D (maxfiles * 9) / 10; What's funny about it? > Historical reasons? To a certain degree, yes; MAXFILES used to be a static limit which you could only change in your kernel config. It is now a loader tunable (though you can still change the default in your kernel config), so the MAXFILES macro was replaced with a maxfiles variable wherever it is used, and the former is now only used to initialize the latter. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no