Page MenuHomeFreeBSD

Support run-time configuration of the PIPE_MINDIRECT threshold.
ClosedPublic

Authored by rwatson on Apr 18 2021, 11:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 22 2024, 6:32 PM
Unknown Object (File)
Sep 30 2024, 7:53 PM
Unknown Object (File)
Sep 30 2024, 4:16 AM
Unknown Object (File)
Sep 26 2024, 12:22 AM
Unknown Object (File)
Sep 13 2024, 3:17 AM
Unknown Object (File)
Sep 10 2024, 10:01 PM
Unknown Object (File)
Sep 3 2024, 8:34 AM
Unknown Object (File)
Aug 31 2024, 1:34 PM
Subscribers

Details

Summary

PIPE_MINDIRECT determines at what (blocking) write size one-copy
optimizations are applied in pipe(2) I/O. That threshold hasn't
been tuned since the 1990s when this code was originally
committed, and allowing run-time reconfiguration will make it
easier to assess whether contemporary microarchitectures would
prefer a different threshold.

(On our local RPi4 baords, the 8k default would ideally be at least
32k, but it's not clear how generalizable that observation is.)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 38840
Build 35729: arc lint + arc unit

Event Timeline

pipe.h has:

/*
 * PIPE_MINDIRECT MUST be smaller than PIPE_SIZE and MUST be bigger
 * than PIPE_BUF.
 */

Do we need to do any validation of the value?

pipe.h has:

/*
 * PIPE_MINDIRECT MUST be smaller than PIPE_SIZE and MUST be bigger
 * than PIPE_BUF.
 */

Do we need to do any validation of the value?

I wasn't imagining we keep this around indefinitely or that it was a regularly frobbed setting. But adding validation is not difficult, and some other similar-ish sysctls do have such checking (e.g., SB_MAX). The value of PIPE_SIZE might also be interesting to revisit -- or at least its implied use here. MAXPIPESIZE has a more sensible value, and if one's using MAXPIPESIZE, one might as well not bother doing a check as other limits will prevent overflowing that [I believe].

Use a sysctl handler to limit possible values of kern.ipc.pipe_mindirect.

Style nit otherwise looks sensible

sys/kern/sys_pipe.c
274

style(9) is to not rely on implicit boolean conversions, ie != 0 and == NULL

This revision is now accepted and ready to land.Apr 24 2021, 12:51 AM
  • Style fix: Differentiate arbitrary integer values from booleans.
This revision now requires review to proceed.Apr 24 2021, 3:32 PM
This revision is now accepted and ready to land.Apr 24 2021, 4:32 PM