bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hou Tao <houtao@huaweicloud.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	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, Hou Tao <houtao1@huawei.com>
Subject: Re: [PATCH bpf-next v5] selftests/bpf: Add benchmark for bpf memory allocator
Date: Mon, 12 Jun 2023 09:46:46 +0800	[thread overview]
Message-ID: <ff4b2396-48aa-28f1-c91b-7c8a4b9510bb@huaweicloud.com> (raw)
In-Reply-To: <CAADnVQJ5m_gT2h41m2_tuf=GDGSWzVSA6ixOwQECzGv8VimZwA@mail.gmail.com>

Hi,

On 6/10/2023 2:23 AM, Alexei Starovoitov wrote:
> On Thu, Jun 8, 2023 at 7:08 PM Hou Tao <houtao@huaweicloud.com> wrote:
>>
>> (1) non-preallocated + no bpf memory allocator (v6.0.19)
>> use kmalloc() + call_rcu
>>
>> | name               | loop (k/s)| average memory (MiB)| peak memory (MiB)|
>> | --                 | --        | --                  | --               |
>> | no_op              | 681.40    | 0.87                | 1.00             |
>> | overwrite          | 8.56      | 38.86               | 88.42            |
>> | batch_add_batch_del| 6.74      | 41.28               | 69.70            |
>> | add_del_on_diff_cpu| 4.68      | 3.43                | 5.70             |
>>
>> (2) preallocated
>> OPTS=--preallocated
>>
>> | name               | loop (k/s)| average memory (MiB)| peak memory (MiB)|
>> | --                 | --        | --                  | --               |
>> | no_op              | 673.95    | 1.98                | 1.98             |
>> | overwrite          | 114.63    | 1.99                | 1.99             |
>> | batch_add_batch_del| 78.34     | 2.04                | 2.06             |
>> | add_del_on_diff_cpu| 6.41      | 2.23                | 2.54             |
>>
>> (3) normal bpf memory allocator
>>
>> | name               | loop (k/s)| average memory (MiB)| peak memory (MiB)|
>> | --                 | --        | --                  | --               |
>> | no_op              | 656.20    | 0.99                | 0.99             |
>> | overwrite          | 81.21     | 1.10                | 2.49             |
>> | batch_add_batch_del| 18.40     | 2.13                | 2.62             |
>> | add_del_on_diff_cpu| 5.38      | 10.40               | 18.05            |
> I have a feeling that you didn't remeasure things and just copy pasted
> above from v4.
I indeed reran the benchmark for v5. But I did in a wrong kernel
version, so the benchmark for normal bpf memory allocator doesn't seem
right.
> I see vastly different numbers in v5.
> and peak memory usage is broken.
My bad. Forgot to include the change of htab_mem_report_final() in the
final v5. The call of cleanup_cgroup_environment() should be moved to
the end of htab_mem_report_final(). Will fix in v6.
> It always shows:
> peak memory usage    0.00MiB


      reply	other threads:[~2023-06-12  1:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09  2:40 [PATCH bpf-next v5] selftests/bpf: Add benchmark for bpf memory allocator Hou Tao
2023-06-09  3:19 ` Alexei Starovoitov
2023-06-09  6:32   ` Hou Tao
2023-06-09 16:12     ` Alexei Starovoitov
2023-06-12  0:56       ` Hou Tao
2023-06-12 23:17       ` Andrii Nakryiko
2023-06-12 23:38         ` Alexei Starovoitov
2023-06-13  0:10           ` Andrii Nakryiko
2023-06-09 18:23 ` Alexei Starovoitov
2023-06-12  1:46   ` Hou Tao [this message]

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=ff4b2396-48aa-28f1-c91b-7c8a4b9510bb@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).