Re: [External] Re: [PATCH v5 1/2] bpf: avoid grabbing spin_locks of all cpus when no free elems

From: Feng Zhou
Date: Wed Jun 08 2022 - 04:07:46 EST


在 2022/6/8 上午11:39, Alexei Starovoitov 写道:
On Tue, Jun 7, 2022 at 7:11 PM Feng zhou <zhoufeng.zf@xxxxxxxxxxxxx> wrote:
From: Feng Zhou <zhoufeng.zf@xxxxxxxxxxxxx>

This patch use head->first in pcpu_freelist_head to check freelist
having free or not. If having, grab spin_lock, or check next cpu's
freelist.

Before patch: hash_map performance
./map_perf_test 1
0:hash_map_perf pre-alloc 975345 events per sec
4:hash_map_perf pre-alloc 855367 events per sec
12:hash_map_perf pre-alloc 860862 events per sec
8:hash_map_perf pre-alloc 849561 events per sec
3:hash_map_perf pre-alloc 849074 events per sec
6:hash_map_perf pre-alloc 847120 events per sec
10:hash_map_perf pre-alloc 845047 events per sec
5:hash_map_perf pre-alloc 841266 events per sec
14:hash_map_perf pre-alloc 849740 events per sec
2:hash_map_perf pre-alloc 839598 events per sec
9:hash_map_perf pre-alloc 838695 events per sec
11:hash_map_perf pre-alloc 845390 events per sec
7:hash_map_perf pre-alloc 834865 events per sec
13:hash_map_perf pre-alloc 842619 events per sec
1:hash_map_perf pre-alloc 804231 events per sec
15:hash_map_perf pre-alloc 795314 events per sec

hash_map the worst: no free
./map_perf_test 2048
The commit log talks about some private patch
you've made to map_perf_test.
Please use numbers from the bench added in the 2nd patch.
Also trim commit log to only relevant parts.
ftrace dumps and numbers from all cpus are too verbose
for commit log.

Ok, will do. Thanks.