]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
af_unix: Count cyclic SCC.
authorKuniyuki Iwashima <kuniyu@google.com>
Sat, 15 Nov 2025 02:08:32 +0000 (02:08 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 19 Nov 2025 03:19:31 +0000 (19:19 -0800)
commit58b47c713711b8afbf68e3158d4d5acdead00e9b
tree775ed41aabe820b168c153ee3ac081102e42fccc
parentf83e0e0b63fe57801d22750e31a0afb5403b3d02
af_unix: Count cyclic SCC.

__unix_walk_scc() and unix_walk_scc_fast() call unix_scc_cyclic()
for each SCC to check if it forms a cyclic reference, so that we
can skip GC at the following invocations in case all SCCs do not
have any cycles.

If we count the number of cyclic SCCs in __unix_walk_scc(), we can
simplify unix_walk_scc_fast() because the number of cyclic SCCs
only changes when it garbage-collects a SCC.

So, let's count cyclic SCC in __unix_walk_scc() and decrement it
in unix_walk_scc_fast() when performing garbage collection.

Note that we will use this counter in a later patch to check if a
cycle existed in the previous GC run.

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20251115020935.2643121-2-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/unix/garbage.c