diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2025-11-18 19:19:34 -0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2025-11-18 19:19:34 -0800 |
| commit | cbf4d314acef1b24194a190cd7abb53f93062820 (patch) | |
| tree | 806c03df24aa522a3dc108cbecddb2e12c2adb18 /net/unix/af_unix.c | |
| parent | f83e0e0b63fe57801d22750e31a0afb5403b3d02 (diff) | |
| parent | 24fa77dad25c2f55cc4615c09df2201ef72c66f4 (diff) | |
Merge branch 'af_unix-gc-cleanup-and-optimisation'
Kuniyuki Iwashima says:
====================
af_unix: GC cleanup and optimisation.
Currently, AF_UNIX GC is triggered from close() and sendmsg()
based on the number of inflight AF_UNIX sockets.
This is because the old GC implementation had no idea of the
shape of the graph formed by SCM_RIGHTS references.
The new GC knows whether cyclic references (could) exist.
This series refines such conditions not to trigger GC unless
really needed.
====================
Link: https://patch.msgid.link/20251115020935.2643121-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 3b44cadaed96..e518116f8171 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -733,8 +733,7 @@ static void unix_release_sock(struct sock *sk, int embrion) /* ---- Socket is dead now and most probably destroyed ---- */ - if (READ_ONCE(unix_tot_inflight)) - unix_gc(); /* Garbage collect fds */ + unix_schedule_gc(NULL); } struct unix_peercred { @@ -2099,8 +2098,6 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, if (err < 0) return err; - wait_for_unix_gc(scm.fp); - if (msg->msg_flags & MSG_OOB) { err = -EOPNOTSUPP; goto out; @@ -2394,8 +2391,6 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, if (err < 0) return err; - wait_for_unix_gc(scm.fp); - if (msg->msg_flags & MSG_OOB) { err = -EOPNOTSUPP; #if IS_ENABLED(CONFIG_AF_UNIX_OOB) |