[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADxym3YMX063-9S7ZgdMH9PPjmRXj9WG0sesn_och5G+js-P9A@mail.gmail.com>
Date: Tue, 23 Sep 2025 17:30:13 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: tgraf@...g.ch, linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
Neil Brown <neil@...wn.name>
Subject: Re: [PATCH] rhashtable: add likely() to __rht_ptr()
On Tue, Sep 23, 2025 at 2:36 PM Herbert Xu <herbert@...dor.apana.org.au> wrote:
>
> Menglong Dong <menglong8.dong@...il.com> wrote:
> > In the fast path, the value of "p" in __rht_ptr() should be valid.
> > Therefore, wrap it with a "likely". The performance increasing is tiny,
> > but it's still worth to do it.
> >
> > Signed-off-by: Menglong Dong <dongml2@...natelecom.cn>
> > ---
> > include/linux/rhashtable.h | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
>
> It's not obvious that rht_ptr would be non-NULL. It depends on the
> work load. For example, if you're doing a lookup where most keys
> are non-existent then it would most likely be NULL.
Yeah, I see. In my case, the usage of the rhashtable will be:
add -> lookup, and rht_ptr is alway non-NULL. You are right,
it can be NULL in other situations, and it's not a good idea to
use likely() here ;)
Thanks!
Menglong Dong
>
> Cheers,
> --
> Email: Herbert Xu <herbert@...dor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists