fd: add obvious branch predictions to fdalloc

This commit is contained in:
Mateusz Guzik 2020-07-15 10:14:00 +00:00
parent f1221c59d7
commit 7177149a4d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363213

View File

@ -1847,9 +1847,9 @@ fdalloc(struct thread *td, int minfd, int *result)
* If none is found, grow the file table.
*/
fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
if (fd >= maxfd)
if (__predict_false(fd >= maxfd))
return (EMFILE);
if (fd >= fdp->fd_nfiles) {
if (__predict_false(fd >= fdp->fd_nfiles)) {
allocfd = min(fd * 2, maxfd);
#ifdef RACCT
if (RACCT_ENABLED()) {