From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <gnaaman@drivenets.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<kuniyu@amazon.com>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>
Subject: Re: [PATCH net-next v4 4/6] Convert neighbour iteration to use hlist+macro
Date: Tue, 15 Oct 2024 16:38:51 -0700 [thread overview]
Message-ID: <20241015233851.68607-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20241015165929.3203216-5-gnaaman@drivenets.com>
From: Gilad Naaman <gnaaman@drivenets.com>
Date: Tue, 15 Oct 2024 16:59:24 +0000
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index 4bdf7649ca57..cca524a55c97 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -391,8 +391,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev,
> struct neighbour *n;
> struct neighbour __rcu **np = &nht->hash_buckets[i];
>
> - while ((n = rcu_dereference_protected(*np,
> - lockdep_is_held(&tbl->lock))) != NULL) {
> + neigh_for_each(n, &nht->hash_heads[i]) {
> if (dev && n->dev != dev) {
> np = &n->next;
> continue;
> @@ -427,6 +426,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev,
> n->nud_state = NUD_NONE;
> neigh_dbg(2, "neigh %p is stray\n", n);
> }
> + np = &n->next;
> write_unlock(&n->lock);
> neigh_cleanup_and_release(n);
> }
Is this chunk necessary ?
> @@ -976,6 +970,7 @@ static void neigh_periodic_work(struct work_struct *work)
> {
> struct neigh_table *tbl = container_of(work, struct neigh_table, gc_work.work);
> struct neighbour *n;
> + struct hlist_node *tmp;
> struct neighbour __rcu **np;
> unsigned int i;
> struct neigh_hash_table *nht;
nit: let's sort variables in reverse xmas tree order.
> @@ -3124,11 +3117,11 @@ void __neigh_for_each_release(struct neigh_table *tbl,
> lockdep_is_held(&tbl->lock));
> for (chain = 0; chain < (1 << nht->hash_shift); chain++) {
> struct neighbour *n;
> + struct hlist_node *tmp;
> struct neighbour __rcu **np;
nit: reverse xmas tree order.
>
> np = &nht->hash_buckets[chain];
> - while ((n = rcu_dereference_protected(*np,
> - lockdep_is_held(&tbl->lock))) != NULL) {
> + neigh_for_each_safe(n, tmp, &nht->hash_heads[chain]) {
> int release;
>
> write_lock(&n->lock);
> --
> 2.46.0
next prev parent reply other threads:[~2024-10-15 23:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 16:59 [PATCH net-next v4 0/6] Improve neigh_flush_dev performance Gilad Naaman
2024-10-15 16:59 ` [PATCH net-next v4 1/6] Add hlist_node to struct neighbour Gilad Naaman
2024-10-15 22:49 ` Kuniyuki Iwashima
2024-10-15 16:59 ` [PATCH net-next v4 2/6] Define neigh_for_each Gilad Naaman
2024-10-15 22:57 ` Kuniyuki Iwashima
2024-10-15 16:59 ` [PATCH net-next v4 3/6] Convert neigh_* seq_file functions to use hlist Gilad Naaman
2024-10-15 23:25 ` Kuniyuki Iwashima
2024-10-16 9:11 ` Gilad Naaman
2024-10-16 20:54 ` Kuniyuki Iwashima
2024-10-17 6:31 ` Gilad Naaman
2024-10-15 16:59 ` [PATCH net-next v4 4/6] Convert neighbour iteration to use hlist+macro Gilad Naaman
2024-10-15 23:38 ` Kuniyuki Iwashima [this message]
2024-10-16 9:18 ` Gilad Naaman
2024-10-15 16:59 ` [PATCH net-next v4 5/6] Remove bare neighbour::next pointer Gilad Naaman
2024-10-15 16:59 ` [PATCH net-next v4 6/6] Create netdev->neighbour association Gilad Naaman
2024-10-15 23:54 ` Kuniyuki Iwashima
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=20241015233851.68607-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gnaaman@drivenets.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).