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)
Wed, May 20, 7:41 AM
Unknown Object (File)
Sun, May 17, 3:02 PM
Unknown Object (File)
Thu, May 14, 9:03 AM
Unknown Object (File)
Tue, May 12, 8:14 AM
Unknown Object (File)
Tue, May 12, 6:05 AM
Unknown Object (File)
Mon, May 11, 11:49 PM
Unknown Object (File)
Mon, May 11, 11:35 PM
Unknown Object (File)
Sun, May 10, 4:41 AM
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?