From 663de8167e555fe807235a96705390559c1a0d8f Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Tue, 11 Dec 2018 11:57:12 +0000 Subject: [PATCH] fd: stop looking for exact freefile after allocation If a lower fd is closed later, the lookup goes to waste. Allocation always performs the lookup anyway. Sponsored by: The FreeBSD Foundation --- sys/kern/kern_descrip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 26196a57cf28..961351715ec8 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -262,7 +262,7 @@ fdused(struct filedesc *fdp, int fd) if (fd > fdp->fd_lastfile) fdp->fd_lastfile = fd; if (fd == fdp->fd_freefile) - fdp->fd_freefile = fd_first_free(fdp, fd, fdp->fd_nfiles); + fdp->fd_freefile++; } /*