bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hou Tao <houtao@huaweicloud.com>
To: bpf@vger.kernel.org, Martin KaFai Lau <martin.lau@linux.dev>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>, Song Liu <song@kernel.org>,
	Hao Luo <haoluo@google.com>, Yonghong Song <yhs@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Jiri Olsa <jolsa@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	rcu@vger.kernel.org, houtao1@huawei.com
Subject: [PATCH bpf-next v6 0/5] Add benchmark for bpf memory allocator
Date: Tue, 13 Jun 2023 16:09:16 +0800	[thread overview]
Message-ID: <20230613080921.1623219-1-houtao@huaweicloud.com> (raw)

From: Hou Tao <houtao1@huawei.com>

Hi,

This patchset includes some trivial fixes for benchmark framework and
a new benchmark for bpf memory allocator originated from handle-reuse
patchset. Because htab-mem benchmark depends the fixes, so I post these
patches together.

Patch #1 fixes the allocation of local counter. Patch #2 fixes the
outputted error code in error message when using pthead APIs. Patch #3
makes the benchmark run successfuly when the number of consumers and
producers are greater than the number of online CPUs. Patch #4 sets the
default value of consumer_cnt as 0, so all online CPUs could be used by
producer threads. Patch #5 adds a new bpf memory allocator benchmark to
measure the performance and memory usage of bpf hash table map.

Please see individual patches for more details. Comments and suggestions
are always welcome.

Change Log:
v6:
  * add fix patches for benchmark framework
  * updates for htab-mem benchmark (Most of updates are suggested by Alexei)
    * remove --full and --max-entries and use a fixed 8k size for htab
    * remove op_factor and increase op_cnt correctly
    * use -a instead of --prod-affinity in run_bench_htab_mem.sh
    * use $RUN_BENCH in run_bench_htab_mem.sh
    * call cleanup_cgroup_environment() at the end of htab_mem_report_final()

v5: https://lore.kernel.org/bpf/ff4b2396-48aa-28f1-c91b-7c8a4b9510bb@huaweicloud.com/
 * send the benchmark patch alone (suggested by Alexei)
 * limit the max number of touched elements per-bpf-program call to 64 (from Alexei)
 * show per-producer performance (from Alexei)
 * handle the return value of read() (from BPF CI)
 * do cleanup_cgroup_environment() in htab_mem_report_final()

v4: https://lore.kernel.org/bpf/20230606035310.4026145-1-houtao@huaweicloud.com/

Hou Tao (5):
  selftests/bpf: Use producer_cnt to allocate local counter array
  selftests/bpf: Output the correct error code for pthread APIs
  selftests/bpf: Ensure that next_cpu() returns a valid CPU number
  selftests/bpf: Set the default value of consumer_cnt as 0
  selftests/bpf: Add benchmark for bpf memory allocator

 tools/testing/selftests/bpf/Makefile          |   3 +
 tools/testing/selftests/bpf/bench.c           |  19 +-
 tools/testing/selftests/bpf/bench.h           |   1 +
 .../bpf/benchs/bench_bloom_filter_map.c       |  14 +-
 .../benchs/bench_bpf_hashmap_full_update.c    |  10 +-
 .../bpf/benchs/bench_bpf_hashmap_lookup.c     |  10 +-
 .../selftests/bpf/benchs/bench_bpf_loop.c     |  10 +-
 .../selftests/bpf/benchs/bench_count.c        |  14 +-
 .../selftests/bpf/benchs/bench_htab_mem.c     | 303 ++++++++++++++++++
 .../bpf/benchs/bench_local_storage.c          |  12 +-
 .../bpf/benchs/bench_local_storage_create.c   |   8 +-
 .../bench_local_storage_rcu_tasks_trace.c     |  10 +-
 .../selftests/bpf/benchs/bench_rename.c       |  15 +-
 .../selftests/bpf/benchs/bench_ringbufs.c     |   2 +-
 .../selftests/bpf/benchs/bench_strncmp.c      |  11 +-
 .../selftests/bpf/benchs/bench_trigger.c      |  21 +-
 .../bpf/benchs/run_bench_htab_mem.sh          |  40 +++
 .../bpf/benchs/run_bench_ringbufs.sh          |  26 +-
 .../selftests/bpf/progs/htab_mem_bench.c      | 107 +++++++
 19 files changed, 502 insertions(+), 134 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/benchs/bench_htab_mem.c
 create mode 100755 tools/testing/selftests/bpf/benchs/run_bench_htab_mem.sh
 create mode 100644 tools/testing/selftests/bpf/progs/htab_mem_bench.c

-- 
2.29.2


             reply	other threads:[~2023-06-13  7:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13  8:09 Hou Tao [this message]
2023-06-13  8:09 ` [PATCH bpf-next v6 1/5] selftests/bpf: Use producer_cnt to allocate local counter array Hou Tao
2023-06-13  8:09 ` [PATCH bpf-next v6 2/5] selftests/bpf: Output the correct error code for pthread APIs Hou Tao
2023-06-13  8:09 ` [PATCH bpf-next v6 3/5] selftests/bpf: Ensure that next_cpu() returns a valid CPU number Hou Tao
2023-06-13  8:09 ` [PATCH bpf-next v6 4/5] selftests/bpf: Set the default value of consumer_cnt as 0 Hou Tao
2023-06-13  8:09 ` [PATCH bpf-next v6 5/5] selftests/bpf: Add benchmark for bpf memory allocator Hou Tao
2023-06-19 20:35   ` Alexei Starovoitov
2023-06-20  1:42     ` Hou Tao
2023-06-19 20:40 ` [PATCH bpf-next v6 0/5] " patchwork-bot+netdevbpf

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=20230613080921.1623219-1-houtao@huaweicloud.com \
    --to=houtao@huaweicloud.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=houtao1@huawei.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yhs@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).