From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E35D32C15B2; Tue, 31 Mar 2026 16:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774975783; cv=none; b=EFR51zQBTyBneDkONAlX8P+V45SS6DcWyeyLZL7CCiZVsOK4dlMvTbdloYdofXst9TkthJGeqHOfwEYNBbogFbiatGZsj1q9a9zCvwA4LyWFSexBkIElVdA0XIKtD9l5AbeJZG+3EHfOa+v4GNyUIgv1/PbrLQQZSp3Z4c6AzUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774975783; c=relaxed/simple; bh=+vmAX3mbGBVq2CVJ9Jviwd+o7nh7mKw1aXUGPtoRmQA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DFHW8n20d4DfUe1LOXjTZgnE50Cz90j8am1yprva/Tkit5qhXs25fiwrlBT3GfVu7U4sFwFJ9yyYAdTUUWTjXwpbmB7hxY1MyNoTLk02Q9PFqB0HdO2kzYynrPkCp9ELXAyGt96ziLXaEPdBDYPZ3lPqXphGDqN8AFX7NlkUWTs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pNhPj8Uc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pNhPj8Uc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33CAFC19423; Tue, 31 Mar 2026 16:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774975782; bh=+vmAX3mbGBVq2CVJ9Jviwd+o7nh7mKw1aXUGPtoRmQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNhPj8Uc66RsCCPaDbNAwOShtQItKNZD3DI6UpFBkaH2YxMoN16vxYYrgFVdFnIIn QV2NgBHYtGK1ohk4BC+lYz5Q97pYFQgTFzg8tEP0jJgsPyX4gvOEPRmA+p2ez66rTh 8oi12k8GVV06KKIgUjmJ5Qtu7ixpJkGrh5mPTpS8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kuniyuki Iwashima , Xin Long , David Ahern , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 085/244] ipv6: Remove permanent routes from tb6_gc_hlist when all exceptions expire. Date: Tue, 31 Mar 2026 18:20:35 +0200 Message-ID: <20260331161744.820145606@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331161741.651718120@linuxfoundation.org> References: <20260331161741.651718120@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kuniyuki Iwashima [ Upstream commit 6af51e9f31336632263c4680b2a3712295103e1f ] Commit 5eb902b8e719 ("net/ipv6: Remove expired routes with a separated list of routes.") introduced a per-table GC list and changed GC to iterate over that list instead of traversing the entire route table. However, it forgot to add permanent routes to tb6_gc_hlist when exception routes are added. Commit cfe82469a00f ("ipv6: add exception routes to GC list in rt6_insert_exception") fixed that issue but introduced another one. Even after all exception routes expire, the permanent routes remain in tb6_gc_hlist, potentially negating the performance benefits intended by the initial change. Let's count gc_args->more before and after rt6_age_exceptions() and remove the permanent route when the delta is 0. Note that the next patch will reuse fib6_age_exceptions(). Fixes: cfe82469a00f ("ipv6: add exception routes to GC list in rt6_insert_exception") Signed-off-by: Kuniyuki Iwashima Reviewed-by: Xin Long Reviewed-by: David Ahern Link: https://patch.msgid.link/20260320072317.2561779-2-kuniyu@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/ip6_fib.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 01c953a39211a..fca68fb1b74c2 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -2314,6 +2314,17 @@ static void fib6_flush_trees(struct net *net) /* * Garbage collection */ +static void fib6_age_exceptions(struct fib6_info *rt, struct fib6_gc_args *gc_args, + unsigned long now) +{ + bool may_expire = rt->fib6_flags & RTF_EXPIRES && rt->expires; + int old_more = gc_args->more; + + rt6_age_exceptions(rt, gc_args, now); + + if (!may_expire && old_more == gc_args->more) + fib6_remove_gc_list(rt); +} static int fib6_age(struct fib6_info *rt, struct fib6_gc_args *gc_args) { @@ -2336,7 +2347,7 @@ static int fib6_age(struct fib6_info *rt, struct fib6_gc_args *gc_args) * Note, that clones are aged out * only if they are not in use now. */ - rt6_age_exceptions(rt, gc_args, now); + fib6_age_exceptions(rt, gc_args, now); return 0; } -- 2.51.0