HomeFreeBSD

kenv: avoid sleepable alloc for integer tunables

Description

kenv: avoid sleepable alloc for integer tunables

Avoid performing a potentially-blocking malloc for kenv lookups that will only
perform non-destructive integer conversions on the returned buffer. Instead,
perform the strtoq() in-place with the kenv lock held.

While here, factor the logic around kenv_lock acquire and release into
kenv_acquire() and kenv_release(), and use these functions for some light
cleanup. Collapse getenv_string_buffer() into kern_getenv(), as the former
no longer has any other callers and the only additional task performed by
the latter is a WITNESS check that hasn't been useful since r362231.

PR: 248250
Reported by: gbe
Reviewed by: mjg
Tested by: gbe
Differential Revision: https://reviews.freebsd.org/D26010

Details

Provenance
jahAuthored on Aug 14 2020, 9:37 PM
mavCommitted on Feb 17 2021, 5:52 PM
Reviewer
mjg
Differential Revision
D26010: kenv: avoid sleepable alloc for integer tunables
Parents
rG9cc7bd9a6ab1: Widen ifnet_detach_sxlock coverage
Branches
Unknown
Tags
Unknown