HomeFreeBSD

kqueue: stream the knote report instead of buffering all of it

Description

kqueue: stream the knote report instead of buffering all of it

kern_proc_kqueues_out() sized its intermediate sbuf from the preceding
sizing pass, so dumping core for a process with many knotes wired a
buffer as large as the entire report.

Shrank the intermediate to one page and added a drain that copied into
the caller's sbuf up to maxlen, stopping the walk once it was reached.
Truncation stayed byte exact.
A dump of 384k knotes peaked at 20 KB of M_SBUF instead of 445 MB.

Reviewed by: adrian, markj
Differential Revision: https://reviews.freebsd.org/D58584
MFC after: 1 week

Details

Provenance
seurosAuthored on Aug 3 2026, 6:12 PM
adrianCommitted on Aug 3 2026, 6:15 PM
Reviewer
adrian
Differential Revision
D58584: kqueue: stream the knote report instead of buffering all of it
Parents
rG5078280bb42c: kqueue: fix the always-empty NT_PROCSTAT_KQUEUES core note
Branches
Unknown
Tags
Unknown