Re: [PATCH] rhashtable: add likely() to __rht_ptr()
From: Herbert Xu
Date: Tue Sep 23 2025 - 02:36:45 EST
Menglong Dong <menglong8.dong@xxxxxxxxx> 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@xxxxxxxxxxxxxxx>
> ---
> 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.
Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt