From: Nam Cao <namcao@linutronix.de>
To: Kuniyuki Iwashima <kuniyu@google.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rt-devel@lists.linux.dev
Cc: Nam Cao <namcao@linutronix.de>
Subject: [PATCH net-next v2 3/3] af_unix: Clean up unix_schedule_gc()
Date: Fri, 17 Jul 2026 08:27:17 +0200 [thread overview]
Message-ID: <548b1b624b13fc2582b1236a2c656e4261eb2525.1784268931.git.namcao@linutronix.de> (raw)
In-Reply-To: <cover.1784268931.git.namcao@linutronix.de>
unix_schedule_gc() is only called with NULL as an argument.
Simplify by deleting the parameter.
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
include/net/af_unix.h | 4 ++--
kernel/exit.c | 2 +-
net/unix/af_unix.c | 2 +-
net/unix/garbage.c | 14 +-------------
4 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 686f6f1d1c21..1dfdc0720052 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -14,14 +14,14 @@
#if IS_ENABLED(CONFIG_UNIX)
struct unix_sock *unix_get_socket(struct file *filp);
-void unix_schedule_gc(struct user_struct *user);
+void unix_schedule_gc(void);
#else
static inline struct unix_sock *unix_get_socket(struct file *filp)
{
return NULL;
}
-static inline void unix_schedule_gc(struct user_struct *user)
+static inline void unix_schedule_gc(void)
{
}
#endif
diff --git a/kernel/exit.c b/kernel/exit.c
index ba9404844523..764a911f111e 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1003,7 +1003,7 @@ void __noreturn do_exit(long code)
exit_sem(tsk);
exit_shm(tsk);
exit_files(tsk);
- unix_schedule_gc(NULL); /* Must be after exit_files() */
+ unix_schedule_gc(); /* Must be after exit_files() */
exit_fs(tsk);
if (group_dead)
disassociate_ctty(1);
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index f7a9d55eee8a..759db734a866 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -733,7 +733,7 @@ static void unix_release_sock(struct sock *sk, int embrion)
/* ---- Socket is dead now and most probably destroyed ---- */
- unix_schedule_gc(NULL);
+ unix_schedule_gc();
}
struct unix_peercred {
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index f180c59b3da9..d46aeb9d2051 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -635,23 +635,11 @@ static void unix_gc(struct work_struct *work)
static DECLARE_WORK(unix_gc_work, unix_gc);
-#define UNIX_INFLIGHT_SANE_USER (SCM_MAX_FD * 8)
-
-void unix_schedule_gc(struct user_struct *user)
+void unix_schedule_gc(void)
{
if (READ_ONCE(unix_graph_state) == UNIX_GRAPH_NOT_CYCLIC)
return;
- /* Penalise users who want to send AF_UNIX sockets
- * but whose sockets have not been received yet.
- */
- if (user &&
- READ_ONCE(user->unix_inflight) < UNIX_INFLIGHT_SANE_USER)
- return;
-
if (!READ_ONCE(gc_in_progress))
queue_work(system_dfl_wq, &unix_gc_work);
-
- if (user && READ_ONCE(unix_graph_cyclic_sccs))
- flush_work(&unix_gc_work);
}
--
2.47.3
prev parent reply other threads:[~2026-07-17 6:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 6:27 [PATCH net-next v2 0/3] af_unix: Fix priority inversion issue Nam Cao
2026-07-17 6:27 ` [PATCH net-next v2 1/3] af_unix: Schedule the garbage collector at task exit Nam Cao
2026-07-17 6:45 ` Nam Cao
2026-07-17 6:27 ` [PATCH net-next v2 2/3] af_unix: Do not wait for garbage collector in sendmsg() Nam Cao
2026-07-17 6:27 ` Nam Cao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=548b1b624b13fc2582b1236a2c656e4261eb2525.1784268931.git.namcao@linutronix.de \
--to=namcao@linutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox