Date: Tue, 11 Dec 2018 11:58:45 +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: r341817 - head/sys/kern Message-ID: <201812111158.wBBBwjIm027964@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Tue Dec 11 11:58:44 2018 New Revision: 341817 URL: https://svnweb.freebsd.org/changeset/base/341817 Log: fd: tidy up closing a fd - avoid a call to knote_close in the common case - annotate mqueue as unlikely Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Tue Dec 11 11:57:12 2018 (r341816) +++ head/sys/kern/kern_descrip.c Tue Dec 11 11:58:44 2018 (r341817) @@ -1186,12 +1186,13 @@ closefp(struct filedesc *fdp, int fd, struct file *fp, * knote_fdclose to prevent a race of the fd getting opened, a knote * added, and deleteing a knote for the new fd. */ - knote_fdclose(td, fd); + if (__predict_false(!TAILQ_EMPTY(&fdp->fd_kqlist))) + knote_fdclose(td, fd); /* * We need to notify mqueue if the object is of type mqueue. */ - if (fp->f_type == DTYPE_MQUEUE) + if (__predict_false(fp->f_type == DTYPE_MQUEUE)) mq_fdclose(td, fd, fp); FILEDESC_XUNLOCK(fdp);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812111158.wBBBwjIm027964>