HomeFreeBSD

Optimize kern.geom.conf* sysctls.

Description

Optimize kern.geom.conf* sysctls.

On large systems those sysctls may generate megabytes of output. Before
this change sbuf(9) code was resizing buffer by 4KB each time many times,
generating tons of TLB shootdowns. Unfortunately in this case existing
sbuf_new_for_sysctl() mechanism, supposed to help with this issue, is not
applicable, since all the sbuf writes are done in different kernel thread.

This change improves situation in two ways:

  • on first sysctl call, not providing any output buffer, it sets special

sbuf drain function, just counting the data and so not needing big buffer;

  • on second sysctl call it uses as initial buffer size value saved on

previous call, so that in most cases there will be no reallocation, unless
GEOM topology changed significantly.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

Details

Provenance
mavAuthored on Jun 18 2019, 9:05 PM
Parents
rGcfdcc8c7fab0: Mark NetBSD branch points
Branches
Unknown
Tags
Unknown

Event Timeline