Linux real-time development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nam Cao" <namcao@linutronix.de>
Cc: linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 2/3] af_unix: Do not wait for garbage collector in sendmsg()
Date: Sat, 18 Jul 2026 06:27:37 +0000	[thread overview]
Message-ID: <20260718062737.8463C1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <471af098e92e7171bf828f619ef6b309b97eb618.1784268931.git.namcao@linutronix.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Removing `unix_schedule_gc()` from `unix_prepare_fpl()` prevents proactive garbage collection of cyclic AF_UNIX FDs.
--

--- Patch [2]: [PATCH net-next v2 2/3] af_unix: Do not wait for garbage collector in sendmsg() ---
commit beb11f61735b0b337472eab3fcd9041c544b30de
Author: Nam Cao <namcao@linutronix.de>

af_unix: Do not wait for garbage collector in sendmsg()

This commit removes the unix_schedule_gc() call from unix_prepare_fpl()
during sendmsg(). The patch notes that previous soft lockup and OOM issues
are already mitigated by async garbage collection and RLIMIT_NOFILE checks.

> diff --git a/net/unix/garbage.c b/net/unix/garbage.c
> index 0783555e25266..f180c59b3da9d 100644
> --- a/net/unix/garbage.c
> +++ b/net/unix/garbage.c
> @@ -300,8 +300,6 @@ int unix_prepare_fpl(struct scm_fp_list *fpl)
>  	if (!fpl->edges)
>  		goto err;
>  
> -	unix_schedule_gc(fpl->user);
> -
>  	return 0;
>  
>  err:

[Severity: High]
Does removing the unix_schedule_gc() call from unix_prepare_fpl() prevent
proactive garbage collection of cyclic AF_UNIX file descriptors?

If a long-running application creates a cycle of AF_UNIX sockets and closes
its own file descriptors to them, the cycle maintains a positive f_count.
Without this call triggering the garbage collector, the uncollected cyclic
sockets could accumulate until the application reaches its RLIMIT_NOFILE
quota, causing subsequent socket operations to fail.

Additionally, does this change leave the user parameter logic in
unix_schedule_gc() as dead code?

If the remaining callers now only pass NULL, the user quota checks in
unix_schedule_gc() will no longer be reachable:

net/unix/garbage.c:unix_schedule_gc() {
	...
	if (user &&
	    READ_ONCE(user->unix_inflight) < UNIX_INFLIGHT_SANE_USER)
		return;
	...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784268931.git.namcao@linutronix.de?part=2

  reply	other threads:[~2026-07-18  6:27 UTC|newest]

Thread overview: 8+ 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-18  6:27   ` sashiko-bot
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-18  6:27   ` sashiko-bot [this message]
2026-07-17  6:27 ` [PATCH net-next v2 3/3] af_unix: Clean up unix_schedule_gc() Nam Cao
2026-07-18  6:27   ` sashiko-bot

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=20260718062737.8463C1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=namcao@linutronix.de \
    --cc=sashiko-reviews@lists.linux.dev \
    /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