All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Mykyta Yatsenko" <mykyta.yatsenko5@gmail.com>,
	<bpf@vger.kernel.org>, <andrii@kernel.org>,
	<daniel@iogearbox.net>, <kernel-team@meta.com>,
	<eddyz87@gmail.com>, <memxor@gmail.com>
Cc: "Mykyta Yatsenko" <yatsenko@meta.com>
Subject: Re: [PATCH bpf-next] bpf: Speed up htab hashing for u32/u64 keys
Date: Mon, 21 Sep 2026 17:00:30 +0000	[thread overview]
Message-ID: <DLL5LJUBBBNP.K6GOQ6AV8OU0@gmail.com> (raw)
In-Reply-To: <179000542526.3934731.994864591824564797@gmail.com>

On Mon Sep 21, 2026 at 3:43 PM UTC, Alexei Starovoitov wrote:
> >  static inline u32 htab_map_hash(const void *key, u32 key_len, u32 hashrnd)
> >  {
> > -	if (likely(key_len % 4 == 0))
> > +	const u32 *k = key;
> > +	u32 b;
> > +
> > +	if (key_len == sizeof(u32))
> > +		b = 0;
> > +	else if (key_len == sizeof(u64))
> > +		b = k[1];
> > +	else if (likely(key_len % 4 == 0))
> >  		return jhash2(key, key_len / 4, hashrnd);

Nice improvement, but key_size is known at verification time.
Let's do a step further and specialize htab_map_gen_lookup
for small key sizes?


  parent reply	other threads:[~2026-09-21 17:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 15:28 [PATCH bpf-next] bpf: Speed up htab hashing for u32/u64 keys Mykyta Yatsenko
2026-09-21 16:45 ` Anton Protopopov
     [not found] ` <179000542526.3934731.994864591824564797@gmail.com>
2026-09-21 17:00   ` Alexei Starovoitov [this message]
2026-09-21 17:10     ` Mykyta Yatsenko

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=DLL5LJUBBBNP.K6GOQ6AV8OU0@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=memxor@gmail.com \
    --cc=mykyta.yatsenko5@gmail.com \
    --cc=yatsenko@meta.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 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.