[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 11 Nov 2019 16:40:29 +0000
From: Song Liu <songliubraving@...com>
To: Andrii Nakryiko <andriin@...com>
CC: bpf <bpf@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"andrii.nakryiko@...il.com" <andrii.nakryiko@...il.com>,
Kernel Team <Kernel-team@...com>,
Rik van Riel <riel@...riel.com>,
Johannes Weiner <hannes@...xchg.org>
Subject: Re: [PATCH v2 bpf-next 1/3] bpf: add mmap() support for
BPF_MAP_TYPE_ARRAY
> On Nov 9, 2019, at 12:06 AM, Andrii Nakryiko <andriin@...com> wrote:
>
> Add ability to memory-map contents of BPF array map. This is extremely useful
> for working with BPF global data from userspace programs. It allows to avoid
> typical bpf_map_{lookup,update}_elem operations, improving both performance
> and usability.
[...]
>
> Generated code for memory-mapped array:
>
> ; p = bpf_map_lookup_elem(&data_map, &zero);
> 22: (18) r1 = map[id:27]
> 24: (07) r1 += 400 /* array->data offset */
> 25: (79) r1 = *(u64 *)(r1 +0) /* extra dereference */
> 26: (61) r0 = *(u32 *)(r2 +0)
> 27: (35) if r0 >= 0x3 goto pc+3
> 28: (67) r0 <<= 3
> 29: (0f) r0 += r1
> 30: (05) goto pc+1
> 31: (b7) r0 = 0
>
> Cc: Rik van Riel <riel@...riel.com>
> Cc: Johannes Weiner <hannes@...xchg.org>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
Acked-by: Song Liu <songliubraving@...com>
Powered by blists - more mailing lists