From owner-freebsd-current@FreeBSD.ORG Tue Aug 23 10:26:28 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1A0A516A41F for ; Tue, 23 Aug 2005 10:26:28 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.10.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F53143D49 for ; Tue, 23 Aug 2005 10:26:27 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (envelope-from xdivac02@eva.fit.vutbr.cz) (8.13.4/8.13.3) with ESMTP id j7NAQNVZ097383 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Tue, 23 Aug 2005 12:26:23 +0200 (CEST) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.4/8.13.3/Submit) id j7NAQNnE097382; Tue, 23 Aug 2005 12:26:23 +0200 (CEST) Date: Tue, 23 Aug 2005 12:26:23 +0200 From: Divacky Roman To: Kris Kennaway Message-ID: <20050823102623.GA97332@stud.fit.vutbr.cz> References: <20050821084546.GA77111@stud.fit.vutbr.cz> <20050821175406.GA36164@xor.obsecurity.org> <868xyu3wln.fsf@xps.des.no> <20050822161339.GA13907@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050822161339.GA13907@xor.obsecurity.org> User-Agent: Mutt/1.4.2i X-Scanned-By: MIMEDefang 2.49 on 147.229.10.14 Cc: Dag-Erling Sm?rgrav , current@freebsd.org Subject: Re: [PATCH]: fdalloc optimization X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2005 10:26:28 -0000 On Mon, Aug 22, 2005 at 12:13:39PM -0400, Kris Kennaway wrote: > On Mon, Aug 22, 2005 at 03:55:00PM +0200, Dag-Erling Sm?rgrav wrote: > > Kris Kennaway writes: > > > On Sun, Aug 21, 2005 at 10:45:46AM +0200, Divacky Roman wrote: > > > > I made a patch for fdalloc which could speed it up a bit, its stored under > > > > kern/85176 or http://hysteria.sk/~neologism/kern_descrip.patch > > > That's all nice and everything, but *does* it speed it up a bit? :-) > > > > It won't make a measurable difference, but that doesn't mean the patch > > is wrong. > > Just that it's not an optimization, as it was advertised :) As > Poul-Henning said, if you can't measure a performance difference > either way then sell it some other way. here is my analyze of the problem - if its correct then the patch speeds it up the code in fact looks: if (fd == fdp->fd_freefile) fdp->fd_freefile = fd_first_free(fdp, fd, fdp->fd_nfiles); fdp->fd_freefile = fd_first_free(fdp, fd, fdp->fd_nfiles); fd cannot be lower then fd_freefile (because fd is technically the first available fd) if fd > fd_freefile it makes no sense to reset it because we would make a gap in the bitarray if fd == fd_freefile we must reset it because the fd is not free anymore anyway - there is clear duplicity the fd_freefile hinting idea is quite clear (if fd_freefile is first available fd it makes sense to start searching from here cause everything before that is used) roman