All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Dave Marchevsky <davemarchevsky@fb.com>
Cc: Martin KaFai Lau <kafai@fb.com>, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v5 bpf-next] selftests/bpf: Add benchmark for local_storage get
Date: Thu, 9 Jun 2022 08:49:15 -0700	[thread overview]
Message-ID: <CAADnVQJ+q6gmSt6E7YmhrdbNbW53tAwC3JKHEF1ts7VBU=x5GQ@mail.gmail.com> (raw)
In-Reply-To: <79b4e95c-437d-45c5-c7a8-c077f692c18a@fb.com>

On Thu, Jun 9, 2022 at 7:27 AM Dave Marchevsky <davemarchevsky@fb.com> wrote:
> >> +
> >> +    if (use_hashmap) {
> >> +            idx = bpf_get_prandom_u32() % hashmap_num_keys;
> >> +            bpf_map_lookup_elem(inner_map, &idx);
> > Is the hashmap populated ?
> >
>
> Nope. Do you expect this to make a difference? Will try when confirming key /
> val size above.

Martin brought up an important point.
The map should be populated.
If the map is empty lookup_nulls_elem_raw() will select a bucket,
it will be empty and it will return NULL.
Whereas the more accurates apples to apples comparison
would be to find a task in a map, since bpf_task_storage_get(,F_CREATE);
will certainly find it.
Then if (l->hash == hash && !memcmp ... will be triggered.
When we're counting nsecs that should be noticeable.

  reply	other threads:[~2022-06-09 15:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-04 22:20 [PATCH v5 bpf-next] selftests/bpf: Add benchmark for local_storage get Dave Marchevsky
2022-06-08 23:02 ` Martin KaFai Lau
2022-06-09 14:27   ` Dave Marchevsky
2022-06-09 15:49     ` Alexei Starovoitov [this message]
2022-06-20 19:49       ` Dave Marchevsky
2022-06-22 23:00 ` Yosry Ahmed
2022-06-24 20:22   ` Martin KaFai Lau
2022-06-24 21:25     ` Yosry Ahmed

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='CAADnVQJ+q6gmSt6E7YmhrdbNbW53tAwC3JKHEF1ts7VBU=x5GQ@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davemarchevsky@fb.com \
    --cc=kafai@fb.com \
    --cc=kernel-team@fb.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.