Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Aug 2005 10:11:30 +0200 (CEST)
From:      Divacky Roman <xdivac02@stud.fit.vutbr.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/85176: optimization of fdalloc
Message-ID:  <200508210811.j7L8BU96075666@eva.fit.vutbr.cz>
Resent-Message-ID: <200508210820.j7L8KH3X032326@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         85176
>Category:       kern
>Synopsis:       optimization of fdalloc
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 21 08:20:17 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Divacky Roman
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
home
>Environment:
FreeBSD witten 7.0-CURRENT FreeBSD 7.0-CURRENT #64: Sun Aug 21 09:42:53 CEST
2005     root@witten:/usr/obj/usr/src/sys/NEOLOGISM  i386


	
>Description:

fdalloc contains a dupliacte code which is removed by this patch + hinting by
fd_freefile, should be a bit faster

if commited - the commented code should/could be just removed
	
>How-To-Repeat:
apply the patch

>Fix:

Index: kern_descrip.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v
retrieving revision 1.279
diff -u -r1.279 kern_descrip.c
--- kern_descrip.c	25 Jun 2005 03:34:49 -0000	1.279
+++ kern_descrip.c	21 Aug 2005 07:29:24 -0000
@@ -1242,6 +1242,9 @@
 	maxfd = min((int)lim_cur(p, RLIMIT_NOFILE), maxfilesperproc);
 	PROC_UNLOCK(p);
 
+	/* hinting by fd_freefile */
+	if (fdp->fd_freefile > minfd)
+		minfd = fdp->fd_freefile;	   
 	/*
 	 * Search the bitmap for a free descriptor.  If none is found, try
 	 * to grow the file table.  Keep at it until we either get a file
@@ -1267,7 +1270,9 @@
 	    ("free descriptor isn't"));
 	fdp->fd_ofileflags[fd] = 0; /* XXX needed? */
 	fdused(fdp, fd);
-	fdp->fd_freefile = fd_first_free(fdp, fd, fdp->fd_nfiles);
+	/* this is done by fdused
+	 * fdp->fd_freefile = fd_first_free(fdp, fd, fdp->fd_nfiles);
+	 */
 	*result = fd;
 	return (0);
 }
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508210811.j7L8BU96075666>