Page MenuHomeFreeBSD

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

Authored by seuros on Sat, Aug 1, 8:01 AM.
Tags
None
Referenced Files
F168176058: D58584.id.diff
Wed, Aug 26, 5:38 PM
F168109758: D58584.diff
Wed, Aug 26, 10:41 AM
Unknown Object (File)
Thu, Aug 20, 1:14 AM
Unknown Object (File)
Wed, Aug 19, 12:58 PM
Unknown Object (File)
Thu, Aug 13, 9:53 PM
Unknown Object (File)
Thu, Aug 13, 6:41 PM
Unknown Object (File)
Thu, Aug 13, 3:17 PM
Unknown Object (File)
Thu, Aug 13, 1:12 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable