All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: kadlec@netfilter.org, linux-crypto@vger.kernel.org
Subject: Re: [v5 PATCH] rhashtable: Add rhashtable_flush_and_free helper
Date: Mon, 14 Sep 2026 12:16:32 +0200	[thread overview]
Message-ID: <aqfJgFY73ZYtFJmH@strlen.de> (raw)
In-Reply-To: <aqYQJlrjbxEgp4Y4@gondor.apana.org.au>

Herbert Xu <herbert@gondor.apana.org.au> wrote:
> v5 makes the following changes:
> 
> - Add bucket_table dying flag to fix walker race.

Thanks, I rebased the ipset rhashtable conversion patches
on top of this; all tests pass.

> Once rehashes are completely gone, ht->nelems is reset to zero,
> and the new table is installed.

Wrt. to this, you could do:

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 63129a8e223b..c5a3c15b3f7e 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -1265,6 +1265,8 @@ static void rhashtable_free_one(struct rhashtable *ht, struct rhash_head *obj,
 {
        struct rhlist_head *list;

+       atomic_dec(&ht->nelems);
+
        if (!ht->rhlist) {
                free_fn(rht_obj(ht, obj), arg);
                return;


To avoid the need for an 'atomic_set'.  That said, I don't mind the
NULL-plus-concurrent-insertions-drop behaviour, its not an issue for
ipset.

  parent reply	other threads:[~2026-09-14 10:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 10:16 [v2 PATCH] rhashtable: Add rhashtable_flush_and_free helper Herbert Xu
2026-09-12 18:32 ` Florian Westphal
2026-09-12 23:27   ` Herbert Xu
2026-09-13  0:12     ` [v3 " Herbert Xu
2026-09-13  1:34       ` [v4 " Herbert Xu
2026-09-13  2:53         ` [v5 " Herbert Xu
2026-09-13  6:31           ` Florian Westphal
2026-09-14 10:16           ` Florian Westphal [this message]
2026-09-14 10:42             ` Herbert Xu
2026-09-14 14:54               ` Florian Westphal
2026-09-15  4:49                 ` Herbert Xu
2026-09-15  5:45                   ` Herbert Xu

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=aqfJgFY73ZYtFJmH@strlen.de \
    --to=fw@strlen.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=kadlec@netfilter.org \
    --cc=linux-crypto@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.