aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-07-15 10:14:00 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-07-15 10:14:00 +0000
commit7177149a4de9af54ae601db963f57da42ec30313 (patch)
tree2c8b009f60fc0324c334c5ee3d07f4af0092db46
parentf1221c59d7cbec2b5b8f65789368fefbbe2cd8fd (diff)
downloadsrc-7177149a4de9af54ae601db963f57da42ec30313.tar.gz
src-7177149a4de9af54ae601db963f57da42ec30313.zip
fd: add obvious branch predictions to fdalloc
Notes
Notes: svn path=/head/; revision=363213
-rw-r--r--sys/kern/kern_descrip.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 34e980b411ea..8ae399212c64 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -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()) {