Date: Sat, 21 Feb 2026 16:29:10 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: fa77660a3ccb - main - pipe: Avoid unnecessary priv_check() calls in pipespace_new() Message-ID: <6999dd56.31de2.20b92c19@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fa77660a3ccbd5f30e88093703b0f93892ef35d7 commit fa77660a3ccbd5f30e88093703b0f93892ef35d7 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-02-21 16:28:49 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-02-21 16:28:49 +0000 pipe: Avoid unnecessary priv_check() calls in pipespace_new() Running out of pipe map KVA is a rare case, so reorder checks accordingly, presuming that calling priv_check() is more expensive than the calculation. In particular, priv_check() might not be cheap to evaluate if MAC hooks are installed. Reviewed by: olce, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D55378 --- sys/kern/sys_pipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 6531cea31423..e928de1cd776 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -592,8 +592,8 @@ retry: } vm_map_lock(pipe_map); - if (priv_check(curthread, PRIV_PIPEBUF) != 0 && maxpipekva / 100 * - (100 - pipebuf_reserv) < amountpipekva + size) { + if (maxpipekva / 100 * (100 - pipebuf_reserv) < amountpipekva + size && + priv_check(curthread, PRIV_PIPEBUF) != 0) { vm_map_unlock(pipe_map); chgpipecnt(cpipe->pipe_pair->pp_owner->cr_ruidinfo, -size, 0); if (cpipe->pipe_buffer.buffer == NULL &&home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6999dd56.31de2.20b92c19>
