From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 09:38:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1CE681065670; Wed, 13 Jun 2012 09:38:24 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 03E238FC16; Wed, 13 Jun 2012 09:38:22 +0000 (UTC) Received: by eabm6 with SMTP id m6so126713eab.13 for ; Wed, 13 Jun 2012 02:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=16BDir8t0FhqOGueHJJCyURTSw4Kgyb0vpNjBN5YkwU=; b=hHKgh2qsN+I7dYWJGKiHxyWp8tP2A59m2kBly6bb/w0hKXYHEvbkJvjbmorv6kV1Ng L0xV5Z0JMNsg3bKiRDJVdNPAqKMdjGDfW9M2m9zF5j1xwO1UyMLnO9/yqPklxLSGmDxW L5Pn2b4x/emj7gpx6ozwZvS6MCeTrLA69T1bpkIXubmOLDG0QRjJdg34uoTFymZroS7Z dDKLL7jQLwo7ed1GU7zteKmpucMFqM9CyzqpLDZKLXBitKp5CzfbwrmMPVuB4+UYMpoS QlslEUeVNLcC1cbiWCNJORX3L6d1h3xnEyDUvGApzkFuavXUfVBHy4DxHC5pFh5dZsL4 b+7w== Received: by 10.14.47.3 with SMTP id s3mr7899539eeb.127.1339580301848; Wed, 13 Jun 2012 02:38:21 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id t3sm5341598eeb.15.2012.06.13.02.38.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Jun 2012 02:38:15 -0700 (PDT) Date: Wed, 13 Jun 2012 11:38:07 +0200 From: Mateusz Guzik To: Pawel Jakub Dawidek Message-ID: <20120613093807.GA3893@dft-labs.eu> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120612214400.GB1429@garage.freebsd.pl> User-Agent: Mutt/1.5.20 (2009-06-14) 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-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 09:38:24 -0000 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 well? > > > > > > > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch > > Ok. Merge racct_set() call into one line, it now fits into 80 chars. > I have no more objections. > This patch contains terrible brain-o: if (fd >= fdp->fd_nfiles) { allocfd = 2 * max(fdp->fd_nfiles, fd); allocfd is always 2 * fd, which I think is ok, just no reason to compare again with fdp->fd_nfiles. Also the patch can be simplified. fdp xlock is held for whole duration of fdalloc. Code: fdgrowtable(fdp, min(allocfd, maxfd)); /* Retry... */ fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); if (fd >= maxfd) return (EMFILE); 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. To sum up: http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free4.patch Any comments? Thanks, -- Mateusz Guzik