git: uipc: Port Unix socket domain GC from FreeBSD.
sephe at crater.dragonflybsd.org
Fri Nov 13 18:58:05 PST 2015
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date: Fri Nov 6 15:24:22 2015 +0800
uipc: Port Unix socket domain GC from FreeBSD.
The new GC code records struct file in unpcb when the unpcb
is used as one of the rights. And GC only scans all unpcbs,
instead of all files, and GC only takes unpcbs used as rights
as targets. Unlike FreeBSD:
- We don't scan sockets on so_comp, since they are on unpcb
- We don't allocate a temporary array for all unreachable
Unix domain sockets, since it could be pretty large.
Instead, the unreachable Unix domain sockets are processed
chunk by chunk (in the same style as our original GC code).
The original GC code is still kept around for reference
And optimize unp_discard() a little bit by calling fdrop()
directly, if the right is not a Unix domain socket. This is
also taken from FreeBSD.
While I'm here, reorder unpcb fields (moving most commonly
used fields to the beginning of unpcb) and add more comment.
Summary of changes:
sys/kern/uipc_usrreq.c | 393 ++++++++++++++++++++++++++++++++++++++++++++-----
sys/sys/unpcb.h | 28 ++--
2 files changed, 370 insertions(+), 51 deletions(-)
DragonFly BSD source repository
More information about the Commits