Page MenuHomeFreeBSD

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

Authored by guest-seuros on Sat, Aug 1, 8:01 AM.
Tags
None
Referenced Files
F165160582: D58584.id183336.diff
Thu, Aug 6, 11:54 AM
F165146115: D58584.id183198.diff
Thu, Aug 6, 9:45 AM
F165122311: D58584.id183336.diff
Thu, Aug 6, 6:07 AM
Unknown Object (File)
Tue, Aug 4, 8:49 PM
Unknown Object (File)
Tue, Aug 4, 8:23 AM
Unknown Object (File)
Tue, Aug 4, 8:12 AM
Unknown Object (File)
Tue, Aug 4, 5:15 AM
Unknown Object (File)
Tue, Aug 4, 12:35 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