]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
af_unix: Don't trigger GC from close() if unnecessary.
authorKuniyuki Iwashima <kuniyu@google.com>
Sat, 15 Nov 2025 02:08:34 +0000 (02:08 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 19 Nov 2025 03:19:31 +0000 (19:19 -0800)
commitda8fc7a39be897426e1ac05aa90263abf40621b7
tree27185a5f11164cfdd47ded1e169d03cf1143c449
parent6b6f3c71fe568aa8ed3e16e9135d88a5f4fd3e84
af_unix: Don't trigger GC from close() if unnecessary.

We have been triggering GC on every close() if there is even one
inflight AF_UNIX socket.

This is because the old GC implementation had no idea of the graph
shape formed by SCM_RIGHTS references.

The new GC knows whether there could be a cyclic reference or not,
and we can do better.

Let's not trigger GC from close() if there is no cyclic reference
or GC is already in progress.

While at it, unix_gc() is renamed to unix_schedule_gc() as it does
not actually perform GC since commit 8b90a9f819dc ("af_unix: Run
GC on only one CPU.").

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20251115020935.2643121-4-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/unix/af_unix.c
net/unix/af_unix.h
net/unix/garbage.c