Author: mjg
Date: Wed Jul 15 10:14:00 2020
New Revision: 363213
URL: https://svnweb.freebsd.org/changeset/base/363213

Log:
  fd: add obvious branch predictions to fdalloc

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c        Wed Jul 15 10:13:23 2020        
(r363212)
+++ head/sys/kern/kern_descrip.c        Wed Jul 15 10:14:00 2020        
(r363213)
@@ -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()) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to