From: Nam Cao <namcao@linutronix.de>
To: sashiko-reviews@lists.linux.dev
Cc: 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
Subject: Re: [PATCH net-next v2 1/3] af_unix: Schedule the garbage collector at task exit
Date: Mon, 20 Jul 2026 09:16:57 +0200 [thread overview]
Message-ID: <87cxwif7va.fsf@yellow.woof> (raw)
In-Reply-To: <20260718062736.199E41F000E9@smtp.kernel.org>
sashiko-bot@kernel.org writes:
> [Severity: Medium]
> Will this race with concurrent task exits and leak cyclic sockets?
>
> In net/unix/garbage.c, unix_schedule_gc() only queues the work if a garbage
> collection is not already running:
>
> void unix_schedule_gc(void)
> {
> if (!READ_ONCE(gc_in_progress))
> queue_work(system_dfl_wq, &unix_gc_work);
> }
>
> If Task A and Task B exit concurrently with dead cyclic sockets:
>
> Task A calls unix_schedule_gc() and triggers the work, which sets
> gc_in_progress to true.
>
> Task B then calls unix_schedule_gc() while the GC is running, observes
> gc_in_progress is true, and silently skips queuing the work.
>
> Task B's newly dead cycles might be missed by the currently running GC pass.
> Since no new GC is queued by Task B, won't those sockets stay behind
> indefinitely until another unrelated task exits, defeating the purpose of
> the patch for concurrent exits?
Yes, this is a pre-existing issue and has been discussed at:
https://lore.kernel.org/lkml/871pde3o54.fsf@yellow.woof/
The solution would be removing gc_in_progress and always calling queue_work().
Since this is not a critical issue, I would fix that after this series
is done.
Nam
next prev parent reply other threads:[~2026-07-20 7:17 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
[not found] ` <20260718062736.199E41F000E9@smtp.kernel.org>
2026-07-20 7:16 ` Nam Cao [this message]
2026-07-17 6:27 ` [PATCH net-next v2 2/3] af_unix: Do not wait for garbage collector in sendmsg() Nam Cao
[not found] ` <20260718062737.8463C1F00A3D@smtp.kernel.org>
2026-07-20 7:26 ` Nam Cao
2026-07-17 6:27 ` [PATCH net-next v2 3/3] af_unix: Clean up unix_schedule_gc() Nam Cao
[not found] ` <20260718062736.C97A31F00A3A@smtp.kernel.org>
2026-07-20 7:43 ` Nam Cao
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=87cxwif7va.fsf@yellow.woof \
--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 \
--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