From: Eelco Chaudron <echaudro@redhat.com>
To: Adrian Moreno <amorenoz@redhat.com>
Cc: netdev@vger.kernel.org, aconole@redhat.com, pabeni@redhat.com,
Ilya Maximets <i.maximets@ovn.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
"open list:OPENVSWITCH" <dev@openvswitch.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v4 4/4] net: openvswitch: avoid double-rcu wait period
Date: Mon, 15 Jun 2026 15:56:01 +0200 [thread overview]
Message-ID: <1913A0FD-1B8B-408B-8F5A-0612854DB5C6@redhat.com> (raw)
In-Reply-To: <20260611045817.1302665-5-amorenoz@redhat.com>
On 11 Jun 2026, at 6:58, Adrian Moreno wrote:
> Avoid waiting for two rcu periods by scheduling the deletion of the
> flow_table and all of its referenced structs at the same time.
Hi Adrian,
One small nit below; the code itself looks fine to me.
Cheers,
Eelco
> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
> ---
> net/openvswitch/flow_table.c | 27 +++++++++++++++------------
> 1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c
> index 3934873a44c3..35232e1af8aa 100644
> --- a/net/openvswitch/flow_table.c
> +++ b/net/openvswitch/flow_table.c
> @@ -527,30 +527,33 @@ static void table_instance_destroy(struct table_instance *ti,
> call_rcu(&ufid_ti->rcu, flow_tbl_destroy_rcu_cb);
> }
>
> -/* No need for locking this function is called from RCU callback. */
> static void ovs_flow_tbl_destroy_rcu(struct rcu_head *rcu)
> {
> struct flow_table *table = container_of(rcu, struct flow_table, rcu);
>
> - struct table_instance *ti = rcu_dereference_raw(table->ti);
> - struct table_instance *ufid_ti = rcu_dereference_raw(table->ufid_ti);
> - struct mask_cache *mc = rcu_dereference_raw(table->mask_cache);
> - struct mask_array *ma = rcu_dereference_raw(table->mask_array);
> -
> - call_rcu(&mc->rcu, mask_cache_rcu_cb);
> - call_rcu(&ma->rcu, mask_array_rcu_cb);
> - table_instance_destroy(ti, ufid_ti);
> mutex_destroy(&table->lock);
> kfree(table);
> }
>
> void ovs_flow_tbl_put(struct flow_table *table)
> {
> + struct table_instance *ufid_ti;
> + struct table_instance *ti;
> + struct mask_cache *mc;
> + struct mask_array *ma;
> +
> if (refcount_dec_and_test(&table->refcnt)) {
> mutex_lock(&table->lock);
> - table_instance_flow_flush(table,
> - ovs_tbl_dereference(table->ti, table),
> - ovs_tbl_dereference(table->ufid_ti, table));
> + ufid_ti = ovs_tbl_dereference(table->ufid_ti, table);
> + ti = ovs_tbl_dereference(table->ti, table);
> + table_instance_flow_flush(table, ti, ufid_ti);
> + table_instance_destroy(ti, ufid_ti);
> +
> + mc = ovs_tbl_dereference(table->mask_cache, table);
> + ma = ovs_tbl_dereference(table->mask_array, table);
> + call_rcu(&mc->rcu, mask_cache_rcu_cb);
> + call_rcu(&ma->rcu, mask_array_rcu_cb);
nit: Would it be cleaner to extract the destruction logic in
ovs_flow_tbl_put() into a separate static function, e.g.
ovs_flow_tbl_destroy(), to separate the refcount handling
from the actual cleanup?
> mutex_unlock(&table->lock);
> call_rcu(&table->rcu, ovs_flow_tbl_destroy_rcu);
> }
prev parent reply other threads:[~2026-06-15 13:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 4:58 [PATCH net-next v4 0/4] net: openvswitch: Decouple flow operations from RTNL Adrian Moreno
2026-06-11 4:58 ` [PATCH net-next v4 1/4] net: openvswitch: make flow_table an rcu pointer Adrian Moreno
2026-06-12 12:32 ` Eelco Chaudron
2026-06-11 4:58 ` [PATCH net-next v4 2/4] net: openvswitch: add per-flow_table lockdep checks Adrian Moreno
2026-06-15 13:55 ` Eelco Chaudron
2026-06-11 4:58 ` [PATCH net-next v4 3/4] net: openvswitch: decouple flow_table from ovs_mutex Adrian Moreno
2026-06-15 13:55 ` Eelco Chaudron
2026-06-11 4:58 ` [PATCH net-next v4 4/4] net: openvswitch: avoid double-rcu wait period Adrian Moreno
2026-06-15 13:56 ` Eelco Chaudron [this message]
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=1913A0FD-1B8B-408B-8F5A-0612854DB5C6@redhat.com \
--to=echaudro@redhat.com \
--cc=aconole@redhat.com \
--cc=amorenoz@redhat.com \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=i.maximets@ovn.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®