]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
af_unix: Avoid Tarjan's algorithm if unnecessary.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Wed, 21 May 2025 15:27:17 +0000 (16:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:40:24 +0000 (14:40 +0200)
commitadfb68b39b39767d6bfb53e48c4f19c183765686
tree0cb80260ae1ff841295e594c2008e850baa0fec2
parentb5b54a38755fc7135e66c4c051f976180e4540b3
af_unix: Avoid Tarjan's algorithm if unnecessary.

commit ad081928a8b0f57f269df999a28087fce6f2b6ce upstream.

Once a cyclic reference is formed, we need to run GC to check if
there is dead SCC.

However, we do not need to run Tarjan's algorithm if we know that
the shape of the inflight graph has not been changed.

If an edge is added/updated/deleted and the edge's successor is
inflight, we set false to unix_graph_grouped, which means we need
to re-classify SCC.

Once we finalise SCC, we set true to unix_graph_grouped.

While unix_graph_grouped is true, we can iterate the grouped
SCC using vertex->scc_entry in unix_walk_scc_fast().

list_add() and list_for_each_entry_reverse() uses seem weird, but
they are to keep the vertex order consistent and make writing test
easier.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/r/20240325202425.60930-12-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/unix/garbage.c