From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 786832DCF55 for ; Sat, 7 Mar 2026 02:47:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772851635; cv=none; b=MuHXQAMQn8TapWVZZ8L8ack3HkB1Y3H1BR69AqE3JGl5QmwdytybUfODgMmcXQcqqrsgB7fO92b+GzKD04K+OjuCuScDahMINg4wcbzuKGQ1P/lRwUiBA0GhOMK0qJ8smKgVQ5Ebd6RKZNwh2hgllxQk7hY//LRylsy2fv5qC74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772851635; c=relaxed/simple; bh=xSUpKyUqiefYtnE4usC+rYtmZsVPKZZW2wiLcUfgKIw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=tCcNGbyFi/B2YDYXzEldDq2r+2DdHSx1Pb/x75Ongl5Et2WCwqX2gkwKxUeerAewUG8tN5zNa9GITgQ6dm2slARsn0nqVzL8LgjhrETobD+4nMGWTp+vqkT7jDj1SoqDPr5SFhqs+1qeRCl3JEVH1MYPJAm6FuXpoQMbBQYRbyY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=r//F17Bj; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="r//F17Bj" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2ae66ee7354so40050145ad.0 for ; Fri, 06 Mar 2026 18:47:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772851634; x=1773456434; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=AvQrkkAIV922a0MPbfbudJznaknrtut3M1bv7F6MyuE=; b=r//F17BjM2ehmXaWDLqYs1aRRtd07o7B4vFxgzIyd8q5jukOR1Mmu1e9iLRIBK3tkx 20zkhc213AZ+f5ov9UI5tWI4IVXJ+lF0QDozulyx25rbLtCtiCpA4y4z/134kZnlK2Fh 1hC3Cb041wEg2g+PWD9Om1iwhEFYCxideSZeDbecH8Zff69uFjTpodGcsg8qOAVtNSg4 X5UiQnIFPva13fHGzpV7nXQwUmCJkHMnhpcBT/k5aH54fYBwpE2IwMobo7tpbkyTzxeL Iz7AsGUD1rMlTVI2wDwUhRZ68RL1AiudekINDpr7g5Gb0g27vyvA2jfSiZAOi/kMTQ0d HL2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772851634; x=1773456434; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AvQrkkAIV922a0MPbfbudJznaknrtut3M1bv7F6MyuE=; b=qqnQEf4xEMqoK1eSeFGi314czTMu9ehq4zUQOTk1xDSduDFYM2a5Pef29ZW9WRc1dQ S9nCeeh9VnsG0XfjceIGT8caWxbKj4QQnb4zZjOHvqeMgMoXY3nIu4R27mV3BPJvChbA quIIe/ri8EaDJ5h7To5O0wNG1ETfO0nmyJCmrrtpoZSs4p38LmkUi5QASW1r17BECo4V dv9W1HWCbUmgSVKWO4LRBtWqz0vl7XGI7RQz1Q1qWIOUyqTISSqqVM3XysYQUluVTKdl NrdA1fqfojT13ZEzrK2VIxDU1VGzNJrJ7MqKI0NYdRJ1r34/p26FIhVk+4zpXwSj3V5+ q+wg== X-Forwarded-Encrypted: i=1; AJvYcCUuzxIuDwoYE29nr3H0mxXIXAk5K/bRHI/Mcr4rEUEzcNK1ql4kndXlfrkrkG4iVJ2wKfkoHps=@vger.kernel.org X-Gm-Message-State: AOJu0Yxp3yrxn8q3wrPmL2Q7O5bja6mWypgaZYzYF54iC+EswYjVX0zB BbzwFjDEjbO3W/c8LlgHa7deF2+M498lVAjMVzeWjZkU+MlprXLCnC2CmcPapIWNrK/8GJuuRiF eDTJr0g== X-Received: from pluo12.prod.google.com ([2002:a17:903:4b0c:b0:2ae:44fc:75e9]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:eb83:b0:2ae:7efa:d804 with SMTP id d9443c01a7336-2ae824e9c40mr40474095ad.36.1772851633654; Fri, 06 Mar 2026 18:47:13 -0800 (PST) Date: Sat, 7 Mar 2026 02:46:56 +0000 In-Reply-To: <20260307024709.718395-1-kuniyu@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260307024709.718395-1-kuniyu@google.com> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260307024709.718395-2-kuniyu@google.com> Subject: [PATCH v1 net 1/2] ipv6: Remove permanent routes from tb6_gc_hlist when all exceptions expire. From: Kuniyuki Iwashima To: David Ahern , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Kui-Feng Lee , Xin Long , Simon Horman , Kuniyuki Iwashima , Kuniyuki Iwashima , netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 --- 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 9058e71241dc..fadfca49d6b1 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -2348,6 +2348,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) { @@ -2370,7 +2381,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.53.0.473.g4a7958ca14-goog