From: Martin KaFai Lau <kafai@fb.com>
To: Joanne Koong <joannekoong@fb.com>
Cc: <bpf@vger.kernel.org>, <andrii@kernel.org>, <ast@kernel.org>,
<daniel@iogearbox.net>, <Kernel-team@fb.com>
Subject: Re: [PATCH v6 bpf-next 1/5] bpf: Add bloom filter map implementation
Date: Thu, 28 Oct 2021 21:49:16 -0700 [thread overview]
Message-ID: <20211029044916.d2e33y3jhwr2dvbi@kafai-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <8ff8008f-baee-123c-d61f-0fd0140ff50d@fb.com>
On Thu, Oct 28, 2021 at 08:17:23PM -0700, Joanne Koong wrote:
> On 10/28/21 2:14 PM, Martin KaFai Lau wrote:
>
> > On Wed, Oct 27, 2021 at 04:45:00PM -0700, Joanne Koong wrote:
> [...]
> > > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> > > index c10820037883..8bead4aa3ad0 100644
> > > --- a/include/uapi/linux/bpf.h
> > > +++ b/include/uapi/linux/bpf.h
> > > @@ -906,6 +906,7 @@ enum bpf_map_type {
> > > BPF_MAP_TYPE_RINGBUF,
> > > BPF_MAP_TYPE_INODE_STORAGE,
> > > BPF_MAP_TYPE_TASK_STORAGE,
> > > + BPF_MAP_TYPE_BLOOM_FILTER,
> > > };
> > > /* Note that tracing related programs such as
> > > @@ -1274,6 +1275,13 @@ union bpf_attr {
> > > * struct stored as the
> > > * map value
> > > */
> > > + /* Any per-map-type extra fields
> > > + *
> > > + * BPF_MAP_TYPE_BLOOM_FILTER - the lowest 4 bits indicate the
> > > + * number of hash functions (if 0, the bloom filter will default
> > > + * to using 5 hash functions).
> > > + */
> > > + __u64 map_extra;
> > > };
> When I run pahole (on an x86-64 machine), I see that there's an 8 byte hole
> right before map_extra in the "union bpf_attr" struct (above this
> paragraph).
> It seems like this should be padded as well with a "__u64 :64;"? I will add
> that in.
hmm... I don't see it.
pahole tools/lib/bpf/libbpf.a:
union bpf_attr {
struct {
__u32 map_type; /* 0 4 */
__u32 key_size; /* 4 4 */
__u32 value_size; /* 8 4 */
__u32 max_entries; /* 12 4 */
__u32 map_flags; /* 16 4 */
__u32 inner_map_fd; /* 20 4 */
__u32 numa_node; /* 24 4 */
char map_name[16]; /* 28 16 */
__u32 map_ifindex; /* 44 4 */
__u32 btf_fd; /* 48 4 */
__u32 btf_key_type_id; /* 52 4 */
__u32 btf_value_type_id; /* 56 4 */
__u32 btf_vmlinux_value_type_id; /* 60 4 */
/* --- cacheline 1 boundary (64 bytes) --- */
__u64 map_extra; /* 64 8 */
}; /* 0 72 */
or you meant another struct/union?
> > > struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
> > > @@ -5638,6 +5646,7 @@ struct bpf_map_info {
> > > __u32 btf_id;
> > > __u32 btf_key_type_id;
> > > __u32 btf_value_type_id;
> > There is also a 4 byte hole here. A "__u32 :32" is needed.
> > You can find details in 36f9814a494a ("bpf: fix uapi hole for 32 bit compat applications")
> >
> > > + __u64 map_extra;
> > > } __attribute__((aligned(8)));
next prev parent reply other threads:[~2021-10-29 4:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 23:44 [PATCH v6 bpf-next 0/5] Implement bloom filter map Joanne Koong
2021-10-27 23:45 ` [PATCH v6 bpf-next 1/5] bpf: Add bloom filter map implementation Joanne Koong
2021-10-28 18:15 ` Andrii Nakryiko
2021-10-29 0:15 ` Joanne Koong
2021-10-29 0:44 ` Andrii Nakryiko
2021-10-28 20:35 ` Alexei Starovoitov
2021-10-28 21:14 ` Martin KaFai Lau
2021-10-29 3:17 ` Joanne Koong
2021-10-29 4:49 ` Martin KaFai Lau [this message]
[not found] ` <6d930e97-424d-393d-4731-ac8eda9e5156@fb.com>
2021-10-29 6:40 ` Martin KaFai Lau
2021-10-27 23:45 ` [PATCH v6 bpf-next 2/5] libbpf: Add "map_extra" as a per-map-type extra flag Joanne Koong
2021-10-28 18:14 ` Andrii Nakryiko
2021-10-27 23:45 ` [PATCH v6 bpf-next 3/5] selftests/bpf: Add bloom filter map test cases Joanne Koong
2021-10-28 18:16 ` Andrii Nakryiko
2021-10-27 23:45 ` [PATCH v6 bpf-next 4/5] bpf/benchs: Add benchmark tests for bloom filter throughput + false positive Joanne Koong
2021-10-28 18:26 ` Andrii Nakryiko
2021-10-27 23:45 ` [PATCH v6 bpf-next 5/5] bpf/benchs: Add benchmarks for comparing hashmap lookups w/ vs. w/out bloom filter Joanne Koong
2021-10-28 22:10 ` [PATCH v6 bpf-next 0/5] Implement bloom filter map Martin KaFai Lau
2021-10-28 23:05 ` Alexei Starovoitov
2021-10-29 0:23 ` Joanne Koong
2021-10-29 0:30 ` Alexei Starovoitov
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=20211029044916.d2e33y3jhwr2dvbi@kafai-mbp.dhcp.thefacebook.com \
--to=kafai@fb.com \
--cc=Kernel-team@fb.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=joannekoong@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).