Bug #2470

[PATCH] network_write_chunkqueue_writev repeatedly calls sysctl to look up iov_max

Added by kevinday almost 3 years ago. Updated over 2 years ago.

Status:FixedStart date:2013-02-05
Priority:NormalDue date:
Assignee:-% Done:


Target version:1.4.33
Missing in 1.5.x:No


On systems with sysconf(_SC_IOV_MAX), network_write_chunkqueue_writev prefers that over other options. On FreeBSD, sysconf is implemented by doing a sysctl lookup of kern.iov_max each time it's called. This has the full weight of a syscall, and is happening once every time through the for() loop.

The patch below checks the max_chunks value only once and remembers it, cutting the number of syscalls network_write_chunkqueue_writev makes in half. Also changes the error message if no way of looking up max_chunks is found to file a bug here instead of annoying Jan by email.

writev.diff.txt Magnifier (2.43 KB) kevinday, 2013-02-05 17:11

Associated revisions

Revision 2885
Added by stbuehler over 2 years ago

[network] use constants available at compile time for maximum number of chunks for writev instead of calling sysconf (fixes #2470)


#1 Updated by stbuehler over 2 years ago

  • Target version set to 1.4.33

#2 Updated by stbuehler over 2 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2885.

Also available in: Atom