Re: [PATCH net-next v4 1/1] af_unix: Do not wait for garbage collector in sendmsg()
From: Kuniyuki Iwashima
Date: Fri Aug 07 2026 - 21:43:08 EST
On Fri, Aug 7, 2026 at 6:07 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> On Tue, 4 Aug 2026 08:46:16 +0200 Nam Cao wrote:
> > AF_UNIX sockets' sendmsg() schedules and blocks on the garbage collector if
> > user has too many inflight unix sockets and there is cyclic reference in
> > the system. This causes real-time issues, as cyclic reference can be
> > created by any task in the system, and high priority tasks who do need to
> > send lots of AF_UNIX sockets get blocked by the garbage collector which
> > runs as workqueue, causing a priority inversion scenario.
>
> Hi Kuniyuki! Any thoughts?
flush_work() makes an insane process slow down by itself and
the sane users (whose peers receive fd in timely manner) can
likely acquire the gc lock before insane users.
The commit message assumes the GC is low priority, and it will
be easier to trigger OOM and soft lockup without the penalty.
If priority inversion on RT kernel is the only problem here, there will
be more flush_work() instances triggered from userspace, and the real
problem is that flush_work() does not implement priority inheritance
like mutex.