From owner-svn-src-head@FreeBSD.ORG Wed Jun 13 10:30:57 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E8E29106566B; Wed, 13 Jun 2012 10:30:57 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 911518FC16; Wed, 13 Jun 2012 10:30:57 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 1E889520; Wed, 13 Jun 2012 12:30:56 +0200 (CEST) Date: Wed, 13 Jun 2012 12:29:01 +0200 From: Pawel Jakub Dawidek To: Mateusz Guzik Message-ID: <20120613102900.GD1386@garage.freebsd.pl> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> <20120612191828.GD20749@dft-labs.eu> <20120612214400.GB1429@garage.freebsd.pl> <20120613093807.GA3893@dft-labs.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="p2kqVDKq5asng8Dg" Content-Disposition: inline In-Reply-To: <20120613093807.GA3893@dft-labs.eu> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 13 Jun 2012 10:30:58 -0000 --p2kqVDKq5asng8Dg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 13, 2012 at 11:38:07AM +0200, Mateusz Guzik wrote: > On Tue, Jun 12, 2012 at 11:44:00PM +0200, Pawel Jakub Dawidek wrote: > > On Tue, Jun 12, 2012 at 09:18:28PM +0200, Mateusz Guzik wrote: > > > On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote: > > > > Look good and you can just add 'In co-operation with: pjd'. > > > > One minor thing is that fd_first_free() can return 'size' if there = are > > > > no free slots available. Could you include that in the comment as w= ell? > > > >=20 > > >=20 > > > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch > >=20 > > Ok. Merge racct_set() call into one line, it now fits into 80 chars. > > I have no more objections. > >=20 >=20 > This patch contains terrible brain-o: >=20 > if (fd >=3D fdp->fd_nfiles) { > allocfd =3D 2 * max(fdp->fd_nfiles, fd); >=20 > allocfd is always 2 * fd, which I think is ok, just no reason to compare > again with fdp->fd_nfiles. >=20 > Also the patch can be simplified. >=20 > fdp xlock is held for whole duration of fdalloc. >=20 > Code: > fdgrowtable(fdp, min(allocfd, maxfd)); > /* Retry... */ > fd =3D fd_first_free(fdp, minfd, fdp->fd_nfiles); > if (fd >=3D maxfd) > return (EMFILE); >=20 > fdgrowtable never fails and when we call it we know that new fd will fit > in the table. In case of no free entries fd_first_free returns size, > which coressponds to first newly allocated fd after growth. So fd after > table growth is already the first free descriptor that can be used and > would be returned by another call to fd_first_free. >=20 > To sum up: > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free4.patch >=20 > Any comments? All makes sense and the code looks good, but I'd love to see such an explanation in the code as well (below or above fdgrowtable() call). --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --p2kqVDKq5asng8Dg Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/Ya2wACgkQForvXbEpPzQXXgCg4w58aYAPKd6Sme7c6LdJgekn BW4An0Qlnq5YQeM+VHwawpBcw8ScVm9s =aGeV -----END PGP SIGNATURE----- --p2kqVDKq5asng8Dg--