svn commit: r363213 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Wed Jul 15 10:14:02 UTC 2020


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()) {


More information about the svn-src-head mailing list