Page MenuHomeFreeBSD

pipe: Avoid unnecessary priv_check() calls in pipespace_new()
ClosedPublic

Authored by markj on Feb 19 2026, 5:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 22, 4:42 PM
Unknown Object (File)
Thu, Mar 19, 9:24 AM
Unknown Object (File)
Tue, Mar 17, 5:34 PM
Unknown Object (File)
Mon, Mar 9, 8:43 PM
Unknown Object (File)
Sun, Mar 8, 12:51 PM
Unknown Object (File)
Fri, Mar 6, 6:30 PM
Unknown Object (File)
Fri, Mar 6, 4:30 PM
Unknown Object (File)
Wed, Mar 4, 3:33 PM
Subscribers

Details

Summary

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. We might further consider precomputing
maxpipekva / 100 at boot time to avoid the division here.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

You could divide by 128 if this is so important.

Could you please explain the motivation for the changes?

This revision is now accepted and ready to land.Feb 19 2026, 5:37 PM
In D55378#1266686, @kib wrote:

You could divide by 128 if this is so important.

Could you please explain the motivation for the changes?

I was looking at sources of frequent priv_check() calls from unprivileged processes, trying to see if any are avoidable. These calls might do some non-trivial work if MAC hooks are installed.

In D55378#1266686, @kib wrote:

You could divide by 128 if this is so important.

Could you please explain the motivation for the changes?

I was looking at sources of frequent priv_check() calls from unprivileged processes, trying to see if any are avoidable. These calls might do some non-trivial work if MAC hooks are installed.

Add the last sentence to the messages?