Page MenuHomeFreeBSD

kqueue: do not buffer the whole knote report when sizing it
ClosedPublic

Authored by guest-seuros on Wed, Jul 29, 5:07 PM.
Tags
None
Referenced Files
F165302700: D58536.id.diff
Fri, Aug 7, 12:57 PM
F165290265: D58536.id183168.diff
Fri, Aug 7, 11:04 AM
F165277860: D58536.id183043.diff
Fri, Aug 7, 9:02 AM
F165259582: D58536.id183170.diff
Fri, Aug 7, 6:01 AM
F165259581: D58536.id183168.diff
Fri, Aug 7, 6:01 AM
F165259577: D58536.id183043.diff
Fri, Aug 7, 6:01 AM
F165259576: D58536.id.diff
Fri, Aug 7, 6:01 AM
F165259552: D58536.diff
Fri, Aug 7, 6:00 AM
Subscribers

Details

Summary

kern_proc_kqueues_out() reported into an intermediate sbuf and copied the
result into the caller's.

A process that had leaked 468k kqueue descriptors wired 757 MB of M_SBUF
while dumping core, over roughly 9M reallocations, then copied the whole
thing again.

PR 296835: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296835

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 75322
Build 72205: arc lint + arc unit

Event Timeline

markj added a subscriber: markj.

This is also bugzilla PR 296835: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296835, please include that in the commit log message.

With the change we avoid the reallocations, but we're still potentially allocating a giant buffer when actually writing out the note, no? I don't really understand why kern_proc_kqueues_out() doesn't just use the caller-supplied sbuf.

This revision is now accepted and ready to land.Fri, Jul 31, 2:12 PM
This revision now requires review to proceed.Fri, Jul 31, 3:45 PM
This revision is now accepted and ready to land.Fri, Jul 31, 3:45 PM