[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVXFVNhEOrroAfiEOC32dB3ZV=73WYJxUtNrpqEE94tvY2fXw@mail.gmail.com>
Date: Fri, 8 Jan 2016 14:55:32 +0800
From: Ming Lei <tom.leiming@...il.com>
To: Martin KaFai Lau <kafai@...com>
Cc: Network Development <netdev@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
FB Kernel Team <kernel-team@...com>,
Alexei Starovoitov <alexei.starovoitov@...il.com>
Subject: Re: [PATCH net-next 0/4] bpf: bpf_htab: Add BPF_MAP_TYPE_PERCPU_HASH
Hi Martin,
On Fri, Jan 8, 2016 at 6:35 AM, Martin KaFai Lau <kafai@...com> wrote:
> This patchset adds BPF_MAP_TYPE_PERCPU_HASH map type which allows
> percpu value.
I am also thinking about using percpu variable to ebpf map, but IMO it
should be better for ARRAY map instead of HASH map, then we can
avoid the atomic op in eBPF program, see example of tracex3, sockex1
and sockex3 in sample/bpf/ of kernel tree. Also looks the ARRAY map
usage in bcc is wrong, strictly speaking.
For HASH map, it is easy to make cpu id as part of key, then the map
can be thought as percpu too, and atomic op isn't needed in eBPF program.
> BPF + kprobe is very useful in statistics collection. In particular,
> bpf is strong in doing aggregation within the kernel instead of
> outputting a lot of raw samples to the userspace.
Exactly, :-)
>
> In some cases, bumping a counter/value of a particular key will have
> noticeable impact. For example, doing statistics collection
> on received packets and aggregating them by network
> prefix (like /64 in IPv6). Having a percpu value can help.
Given it is always related with performance, could you provide some data
about the improvement? Also you can compare this patchset with the
approach of providing cpu id as hash key.
--
Ming Lei
Powered by blists - more mailing lists