Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Jul 2020 10:14:01 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363213 - head/sys/kern
Message-ID:  <202007151014.06FAE1oR001559@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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()) {



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