Article View: linux.kernel.netdev
Article #25552Re: [PATCH net] ipv6: do not wait for a running gc in ip6_dst_gc()
From: David Ahern
Date: Wed, 02 Dec 2026 01:40
Date: Wed, 02 Dec 2026 01:40
52 lines
10390 bytes
10390 bytes
On 11/30/26 6:55 PM, Willem de Bruijn wrote:
> From: Chris Mason <mason@kernel.org>
>
> With more than net.ipv6.route.gc_thresh cached routes, CPUs that
> allocate an IPv6 route while the route garbage collector runs can stall
> for as many gc runs as there are CPUs waiting, with bottom halves
> disabled.
>
> While more than net.ipv6.route.gc_thresh cached routes exist,
> dst_alloc() calls ip6_dst_gc(), which starts a gc run, fib6_run_gc(),
> unless the last one ended less than gc_min_interval ago. A gc run holds
> fib6_gc_lock with bottom halves disabled, and sets ip6_rt_last_gc, the
> time at which the last gc run ended, only at its end. But ip6_dst_gc()
> tests ip6_rt_last_gc before it takes the lock, so each CPU that passes
> the test during a gc run spins for the lock and then starts a gc run of
> its own.
>
> Commit 2ac3ac8f86f2 ("ipv6: prevent fib6_run_gc() contention") in v3.11
> fixed this contention, which it reported as soft lockups on a
> high-traffic router with many processors, by having ip6_dst_gc() only
> try the lock unless the number of entries exceeded max_size. Commit
> 14956643550f ("ipv6: slight optimization in ip6_dst_gc") in v3.16 made
> ip6_dst_gc() wait for the lock again in all cases, on the premise that
> the number of entries always exceeds max_size at that point. That does
> not hold once gc_min_interval has passed since the last gc run.
>
> The fix used here is to give ip6_dst_gc() a variant of fib6_run_gc(),
> fib6_try_run_gc(), which returns at once if another CPU holds
> fib6_gc_lock, and repeats the test of ip6_rt_last_gc under the lock.
>
> Found and fixed with an LLM; reproduced on an unmodified kernel with an
> LLM-generated reproducer in a 16-CPU KVM guest. Verified with the
> reproducer and IPv6 route selftests (fib_tests.sh, fib_nexthops.sh).
>
> Fixes: 14956643550f ("ipv6: slight optimization in ip6_dst_gc")
> Cc: <stable@vger.kernel.org> # 6.18.x: 12eddc685744: ipv6: annotate data-races around sysctl.ip6_rt_gc_interval
> Cc: <stable@vger.kernel.org> # 6.18.x
> Signed-off-by: Chris Mason <mason@kernel.org>
> [willemb: add lockdep_assert_held() and WRITE_ONCE() on ip6_rt_last_gc,
> expand commit message]
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> ---
> include/net/ip6_fib.h | 1 +
> net/ipv6/ip6_fib.c | 44 +++++++++++++++++++++++++++++++++++--------
> net/ipv6/route.c | 4 +++-
> 3 files changed, 40 insertions(+), 9 deletions(-)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
Local sashiko instance back by gpt-6.1-sol found no issues.
Technical Details
Message-ID:
<2bbaa7c4-0772-4ad1-b09b-b4958e301856@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!feed-us-ny.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375475-linux-kernel-netdev=dewy.ruReferences:
<20261201015652.38202-1-willemb@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!feed-us-ny.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375475-linux-kernel-netdev=dewy.ru From: dsahern@kernel.org (David Ahern) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] ipv6: do not wait for a running gc in ip6_dst_gc() Date: Tue, 1 Dec 2026 18:40:34 -0700 Organization: Usenet Network Message-ID: <2bbaa7c4-0772-4ad1-b09b-b4958e301856@kernel.org> References: <20261201015652.38202-1-willemb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1862353"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Jq4znWuHEMWXlsN3fNgL/tZmkgc= sha256:Xf/JyHzc0jg77i0T7hB/ZUfFQrYKefneIJPK2oJCLxE= sha1:jty2ZD6LgaMymz3rmZH73pDlgKc= sha256:gTO8JfS99xr4qpAPq09+gVGiCt2mHjwHVl+gBGYDe2g= Content-Language: en-US List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 51E58117515; Wed, 2 Dec 2026 04:40:50 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uZ5mQFaFkNkh; Wed, 2 Dec 2026 04:40:47 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-375475-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 5D9E11174E7; Wed, 2 Dec 2026 04:40:38 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 15D1A602F41; Wed, 2 Dec 2026 01:40:38 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796175636; b=reApuXegrUY6MnOQphAQt8Bu/dprVj5ON/Kkmmt74I/3I2A5TzeFLHHMiwOJDjF3cT3T mFcACOTk0/RNZafqnk82gK4UsdiRX2kox2phUqxMY8dgwETHOlDc4/EraYEvr2nqOjbAw m1Oqy93+peb/2chokqR57XYDPeCmqWM0mmnT+5vUscc1m3b9TvWs6W5J7B4rxvfQ6t3Ws 1Kjzzi23UE4nWukoRxfOfkfvVC0sPG2UkJ3Uu72ABc/NVnkgq82CEvWt6Nh2+YHbJ/l/j 0t1wPnbpS9KwOEQk5OmU3+OmSG4kx7jCaZFoWUXMM8UDovii3p60+D/jx0nRwSNzVNw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796175636; h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=kPRupaD33W4qRSQ8sT40Wv46/ED0OIz38gj0qIydZiU=; b=V4LZ1BCIYmj1+fV2XqCq/ohcOmVwxE7l1ubyWmJ8zs6xJlJ53ronlLoyWfFFU/fqj9xT 0Pab+llxduaod7rRHNKCrbyoLi5xVmOrOKXb54xRkk+/w649iHGcja7Q5XSs94Ua7jXk1 zmQ+EOr31+8jqC18NEb4U9PaI6xAKy4KW95fdnjJ3rLKX1flxPNqdye8Wt53xAhXgDkt7 od8xsTd7lYlr+aIZnkk2H+rF6e1thfxL58kqsL/b4PdC5HE7IEZeXohjAWpKWEklZaZiF r544ny1HdYLbATxcoGNZ5UUICqCGTxvSjgbxMKwzjZUtrqjwWnYaiUv63DGHpiH7rew== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lhVWQVFn; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 701FE606A336; Wed, 2 Dec 2026 01:40:36 +0000 (UTC) X-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=lhVWQVFn X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796175635; b=kSxzxpTiVEnA7Fi7ofvMfDPG/GsweLZZc3sIJRIlCc1iy8/mLXHqcYe9PA4yr02Qn01r J5ndl6g1XdwRspHfbU+VqlOH4kj9oy+8DXn9Q2sdxtLH2lJK1ozqDMa+ny0TZEB9uXMvh Jatao/3qDg5WwSBHycIgRuBUoJuTByzW0C0Sx2jyoO9v8JI6NGo42qD5difHacBtqMqU3 i2cfaDPCfPe6ShB+iLlcP4EDkbOsaAS1yYTRn3m93gOjae6irL1JCjU+STUL3HlvAel+z A8FcuFOBUGRL83dYGu+/8GGxIBPHpJhKpRuQ4iyCIEhQ1hvLeaY0YWrqBzLJfubdzNA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796175635; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=kPRupaD33W4qRSQ8sT40Wv46/ED0OIz38gj0qIydZiU=; b=zCDNLLyqst/G+sZYM44p0Mh4szyZ8qRin21f5QpOup0aNKhQF+fV3y0/6iSNp3GXSgMQ VV3bu4T4y/LioBrkjOX2vw69ksuVp0uQSz05o7XN3qeHvX4iuqk3L0vMz+V67XGWL16rj lgqFkp46L/6/35S6fBIlvVnQNQMPyzo/uKI8Z/mpgi8RfwFzsJkbG3ZL1NjZx3GRHfrZf R1O2carrJWOtvzRWpJjwag/Ew7Hds75jn9x9dAQdcjJV4BFP+0gbjt3cPnK8nnr78wnHD fBSYxq/9+ikJNxuznaO35wOlF1tJQvQZamHHQItlE0m4loA+yLXqYV0rVHU3BF82K7A== X-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=lhVWQVFn; arc=none smtp.remote-ip=100.103.45.18 X-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 90D75606A32A; Wed, 2 Dec 2026 01:40:35 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7A9B1F00931; Wed, 2 Dec 2026 01:40:34 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796175635; bh=kPRupaD33W4qRSQ8sT40Wv46/ED0OIz38gj0qIydZiU=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=lhVWQVFnDG9i5GTNZbnbbsUSszJtY9gbmLau5ZsxZSKk6m8xLpxz81nV6oOIW8m2C 6CV36YG6OiVVCdum0VP8G7YCnrLzQyuH2XEzppjoLSqfpbzHkZCRrSXpbK0ovNMoF8 HRsumac5HDcDtoy0svorYiGPJSzNxRicl8LXFKVk7tsojJRYQOuLKOKXBfEtM557cd /0wahE4gaGzSy6eTmkvvh4q59Wy+pkD+QXbyIgttPfe06aMew8KV0br/mcqSJxn1FC dwmL1lqikFACDCWGxG1dwIZ51Nh07EPkw+rE6Hs22RF2MrtZqAWm4f4kxxRqCPlzMm d6H4RHVy5YufA== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Mozilla Thunderbird X-Cc: Ido Schimmel <idosch@nvidia.com>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Chris Mason <mason@kernel.org>, stable@vger.kernel.org X-In-Reply-To: <20261201015652.38202-1-willemb@google.com>