netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: thinker.li@gmail.com, netdev@vger.kernel.org, ast@kernel.org,
	martin.lau@linux.dev, kernel-team@meta.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	liuhangbin@gmail.com
Cc: sinquersw@gmail.com, kuifeng@meta.com
Subject: Re: [PATCH net-next v4 3/5] net/ipv6: Remove expired routes with a separated list of routes.
Date: Wed, 7 Feb 2024 08:58:04 -0700	[thread overview]
Message-ID: <d58cb247-b0ac-4cbd-9eb2-34cc5fc2670f@kernel.org> (raw)
In-Reply-To: <20240205214033.937814-4-thinker.li@gmail.com>

On 2/5/24 2:40 PM, thinker.li@gmail.com wrote:
> From: Kui-Feng Lee <thinker.li@gmail.com>
> 
> FIB6 GC walks trees of fib6_tables to remove expired routes. Walking a tree
> can be expensive if the number of routes in a table is big, even if most of
> them are permanent. Checking routes in a separated list of routes having
> expiration will avoid this potential issue.
> 
> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
> ---
>  include/net/ip6_fib.h | 47 ++++++++++++++++++++++++++++++++-
>  net/ipv6/addrconf.c   | 41 ++++++++++++++++++++++++-----
>  net/ipv6/ip6_fib.c    | 60 +++++++++++++++++++++++++++++++++++++++----
>  net/ipv6/ndisc.c      | 10 +++++++-
>  net/ipv6/route.c      | 13 ++++++++--
>  5 files changed, 155 insertions(+), 16 deletions(-)
> 

one nit below, but otherwise

Reviewed-by: David Ahern <dsahern@kernel.org>


> @@ -498,6 +510,39 @@ void fib6_gc_cleanup(void);
>  
>  int fib6_init(void);
>  
> +/* Add the route to the gc list if it is not already there
> + *
> + * The callers should hold f6i->fib6_table->tb6_lock and make sure the
> + * route is on a table.

The last comment is not correct given the fib6_node check below.

> + */
> +static inline void fib6_add_gc_list(struct fib6_info *f6i)
> +{
> +	/* If fib6_node is null, the f6i is not in (or removed from) the
> +	 * table.
> +	 *
> +	 * There is a gap between finding the f6i from the table and
> +	 * calling this function without the protection of the tb6_lock.
> +	 * This check makes sure the f6i is not added to the gc list when
> +	 * it is not on the table.
> +	 */
> +	if (!rcu_dereference_protected(f6i->fib6_node,
> +				       lockdep_is_held(&f6i->fib6_table->tb6_lock)))
> +		return;
> +
> +	if (hlist_unhashed(&f6i->gc_link))
> +		hlist_add_head(&f6i->gc_link, &f6i->fib6_table->tb6_gc_hlist);
> +}
> +


  reply	other threads:[~2024-02-07 15:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 21:40 [PATCH net-next v4 0/5] Remove expired routes with a separated list of routes thinker.li
2024-02-05 21:40 ` [PATCH net-next v4 1/5] net/ipv6: set expires in rt6_add_dflt_router() thinker.li
2024-02-05 21:40 ` [PATCH net-next v4 2/5] net/ipv6: Remove unnecessary clean thinker.li
2024-02-05 21:40 ` [PATCH net-next v4 3/5] net/ipv6: Remove expired routes with a separated list of routes thinker.li
2024-02-07 15:58   ` David Ahern [this message]
2024-02-07 16:00     ` Kui-Feng Lee
2024-02-05 21:40 ` [PATCH net-next v4 4/5] net/ipv6: set expires in modify_prefix_route() if RTF_EXPIRES is set thinker.li
2024-02-07 15:59   ` David Ahern
2024-02-05 21:40 ` [PATCH net-next v4 5/5] selftests/net: Adding test cases of replacing routes and route advertisements thinker.li
2024-02-07 16:03   ` David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d58cb247-b0ac-4cbd-9eb2-34cc5fc2670f@kernel.org \
    --to=dsahern@kernel.org \
    --cc=ast@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=kuifeng@meta.com \
    --cc=liuhangbin@gmail.com \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sinquersw@gmail.com \
    --cc=thinker.li@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).