Repository navigation
Conversation
| // expected that input is already extended if it is coming from splice | ||
| if resize_pipe && fcntl_setpipe_size(&pair.0, MAX_ROOTLESS_PIPE_SIZE).is_ok() { | ||
| // improve throughput if output is pipe | ||
| let _ = fcntl_setpipe_size(&target, MAX_ROOTLESS_PIPE_SIZE); |
There was a problem hiding this comment.
With head -n -1 small big, the small file caches an unresized broker, and the big file then gets neither resize, since the target resize now only happens when the broker is created. Main still resized the target there. Fine if that's intended, since the broker is stuck at 64 KiB either way.
There was a problem hiding this comment.
I'll cache resized state.
There was a problem hiding this comment.
uucore as a library should have PIPE_IS_RESIZED as global variable, but I made it local for our usecase.
|
Binary size comparison: |
effe7e4 to
03182f8
Compare
f54d9ee to
31e101e
Compare
|
This change also avoids N fcntl for N inputs at hot code path. |
31e101e to
5421332
Compare
| thread_local! { | ||
| static PIPE_IS_RESIZED: Cell<bool> = const { Cell::new(false) }; | ||
| } | ||
| let mut pipe_is_resized = PIPE_IS_RESIZED.get(); |
There was a problem hiding this comment.
this flag is only read when PIPE_CACHE is empty, so after the first call it is almost never used
head -n -1 small big still caches an unresized broker and never resizes it, no?
do we need it, or should the resize check happen on the cached pipe too?
There was a problem hiding this comment.
pipe cache is refleshed if and only if we met I/O error which is cold code-path. I'm not sure if we should cache the size too for the case.
There was a problem hiding this comment.
Actually, we save state if and only if we recycled broker (PIPE_CACHE.set). So it is already done.
5421332 to
05b8fb9
Compare
Followup to #15516 .