From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796176532; b=z9SnjSziPFT0vxLoUe3SufPazm4eSKjhDUQmF1FondNVamcfJt+YdiF8uQcpZmwfBY1u 7tNvZJnM7X5BLIdD9mrTsfxP3AxR21/YjWuxLtiNMqHrltebdn9NmCiLW0tmXrTT8yQQs bwfGkbvKtt0F4N7Qn/cbhPmD12K5r/8ZNMONxSE1iPDkKplaXEMvWdVt+9c7rXscajzYw 6GLHJ9YD9wsIuKnIcLOlPg+xfL445OTsBJ0u7i1p+VrrJO52aUjBQrcwEXdf0XbTYLS0Y c2jnk31IncAWC+AJuu3WifjZc6JauQhURuOw2tPfXsDbID/hpOu2pTj8nOrJwJoJ2Gw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796176532; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=U3jPdUSTRnjaTKUPw7FJCnQmzM12sEm3YNDHMP/puJc=; b=YOU32QO4O4SkHYKVS8Gl+VpxlB+S14l2543W1pZ2yYoeC1+CI8K+rwO/cO7zFybnII9I Sy81DSXD5971jQBmk56NiIXeBES/qUAAHMy5O5KNgho4Gkgh9RT4Hy/scAb7OWHRhLKX2 JKpMuBcuxciMmWpS+HtlU8KEqfqvS1sgz+njmOHpqvJ7QV29+vtK6dOexKsCoDgivbgOE wu6LJsNgZuQr3WnQlsfWN4sRnGIgQ/3YxeRmZa9io5MCGfYa8RYPrSJuf5FaCRSouLqEN thhsiXTg0G9cY+SRyi6gIvSMKhULuSpGzJbwVtdEuhNxtwRwFVfegp3FodYkLuDKJWw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YbVVGe7f; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D18F5606A31A for ; Wed, 2 Dec 2026 01:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YbVVGe7f Received: by smtp.kernel.org (Postfix) with ESMTPSA id 078B41F000C1; Wed, 2 Dec 2026 01:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796176532; bh=U3jPdUSTRnjaTKUPw7FJCnQmzM12sEm3YNDHMP/puJc=; h=From:To:Cc:Subject:Date; b=YbVVGe7fhJqzk2Qpl4xz8Oh7WvUNaiY3HaqxKbOXpm6Pdzb6mv6jjKdYa1CWZ522E Q7Cf7QW9kA3Er8Q01hX02l2uq50E28vvqqC8/G0f+gM3s0hGGP8XU2kK/HqyaaDG8f ZODKb/hEAS8MNeNqA2BYqmBd0LVC+/1QyGqCU10QZofYwI2rBwpQeyJ3u2XpbD0etB c7POwhwiMcTXCMZpoFk6LnzMTiA2kgTq51F8GRgCv/YMQJk/KYNS1BurP0ps5wxPiQ sfGLS6Lvv1EsGwg+1f2Z8oF/dyTSW8eWv8vYraYC1seHJpSz5/igT5MkZw37EQrmMZ EU/B/QdCkb+ow== From: David Ahern To: netdev@vger.kernel.org Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org Subject: [PATCH net-next 0/2] ipv6: remove dst_ops gc handler Date: Tue, 1 Dec 2026 18:55:21 -0700 Message-ID: <20261202015529.7846-1-dsahern@kernel.org> X-Mailer: git-send-email 2.54.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit IPv6 is the only address family that still uses dst_ops->gc to limit dst entries. ip6_dst_gc() runs from dst_alloc() whenever the entry count exceeds gc_thresh. It never fails an allocation (max_size is already INT_MAX); it only forces a fib6_run_gc() pass. That pass can free expired exceptions and expired routes on the FIB6 gc list. It cannot free uncached dsts, which are held by sockets and skbs. Remove the handler and rely on the structural limits that already bound the dst count, the same way IPv4 does. How the dst count is bounded ---------------------------- Per-cpu routes are DST_NOCOUNT and are limited to one per cpu per nexthop. Cached exceptions (PMTU, redirect) live in a per-nexthop hash. Each bucket is limited to a randomized depth and the oldest entry is evicted on insert: IPv6 IPv4 buckets 1024 (shift 10) 2048 (shift 11) max depth FIB6_MAX_DEPTH (5) FNHE_RECLAIM_DEPTH (5) + random(0..4) + random(0..4) Time-based expiry: - IPv6: FIB6 gc timer every gc_interval (30s) while the gc list is non-empty. It also runs on route flush, ndisc device events and exception insert. - IPv4: fnhe_expires is checked on lookup and update, and fnhe_genid invalidates stale entries. There is no timer. Uncached dsts (icmp6_dst_alloc(), FLOWI_FLAG_KNOWN_NH clones) are counted but not capped, in both families. They are bounded only by the users holding references. The old gc could not reclaim them either. Behavior changes ---------------- - dst_ops gc_thresh defaults to ~0, as in IPv4. Reading net.ipv6.route.gc_thresh now returns -1 instead of 1024. - gc_thresh, gc_min_interval, gc_min_interval_ms, gc_timeout and gc_elasticity are kept so existing scripts still work. They have no effect, and a write logs a one-time warning. gc_interval is unchanged. - Expired exceptions are no longer reclaimed early under allocation pressure. They stay until the gc timer runs, up to gc_interval plus the exception timeout. Memory is capped at roughly 1024 x 9 entries per nexthop, the same order as IPv4. Patches ------- 1: remove ip6_dst_gc() and its per-netns state, and mark the gc sysctls deprecated 2: selftests: add a stress test for dst_entries David Ahern (2): ipv6: remove dst_ops gc handler selftests: Add stress test for dst_entries include/net/netns/ipv6.h | 2 - net/ipv6/ip6_fib.c | 1 - net/ipv6/route.c | 74 ++++++---- tools/testing/selftests/net/fib_tests.sh | 178 ++++++++++++++++++++++- 4 files changed, 219 insertions(+), 36 deletions(-) -- 2.54.0 (Apple Git-157)