Date: Tue, 31 Mar 2026 15:59:05 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 5f7525c0210c - stable/15 - pipe: Avoid unnecessary priv_check() calls in pipespace_new() Message-ID: <69cbef49.395f8.44cb96b1@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5f7525c0210c9ef8e06b7b3c7e6049e356fad009 commit 5f7525c0210c9ef8e06b7b3c7e6049e356fad009 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-02-21 16:28:49 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-03-31 15:57:29 +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 (cherry picked from commit fa77660a3ccbd5f30e88093703b0f93892ef35d7) --- 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 b319f0ac9c53..e5a49ef3a526 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -600,8 +600,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?69cbef49.395f8.44cb96b1>
