bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Hou Tao <houtao@huaweicloud.com>, 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 17:10:06 -0700	[thread overview]
Message-ID: <CAEf4Bzax=zdncGuNa_+AusYywxqNfSMmTERg_geP60UOm9oGkg@mail.gmail.com> (raw)
In-Reply-To: <CAADnVQKBm7cYAwYtimPaPf_m7TAhf4SXajfuCcLo7DJ+6EXjGg@mail.gmail.com>

On Mon, Jun 12, 2023 at 4:38 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Mon, Jun 12, 2023 at 4:17 PM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
> >
> > On Fri, Jun 9, 2023 at 9:12 AM Alexei Starovoitov
> > <alexei.starovoitov@gmail.com> wrote:
> > >
> > > On Thu, Jun 8, 2023 at 11:32 PM Hou Tao <houtao@huaweicloud.com> wrote:
> > > >
> > > > >
> > > > >> +                    --producers=8 --prod-affinity=0-7 "$@")"
> > > > > -a -p 8 should just work.
> > > > > No need to pick specific cpus.
> > > > No. For VM with only 8 CPUs, the affinity of the first producer will be
> > > > CPU 1 and the affinity of the last producer will be CPU 8, so the
> > > > benchmark will fail to run. But I think I can fix it, so the affinity of
> > > > the last producer will be 0 instead.
> > >
> > > Right. Noticed that too.
> > > That should probably be a separate patch to fix this cpu assignment
> > > issue in bench for all benchs.
> > >
> > > Andrii,
> > > when you wrote it did you really mean to start assigning cpus from 1
> > > or that was just an oversight?
> >
> >   616 ▸       /* unless explicit producer CPU list is specified, continue after¬
> >   617 ▸        * last consumer CPU¬
> >   618 ▸        */¬
> >
> >
> > It's been a while, but it seems like each consumer gets its CPU first,
> > then each producer. So yeah, seems intentional.
> >
> > For context, this was done for BPF ringbuf benchmarking, so by default
> > I wanted to separate a single consumer from multiple producers.
>
> I see. In this cas Hou's bench has empty consumer:
> +static void *htab_mem_consumer(void *arg)
> +{
> +       return NULL;
> +}
>
> but setup_benchmark() still creates an instant 'return NULL' thread
> and pins it to cpu 0.
>
> I guess the fix is for htab-mem bench to set env.consumer_cnt = 0
> at init time and don't supply empty consumer at all.
>
> May be consumer_cnt=0 can a default and ringbuf bench will just the
> default to 1?

makes sense

  reply	other threads:[~2023-06-13  0:10 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 [this message]
2023-06-09 18:23 ` Alexei Starovoitov
2023-06-12  1:46   ` Hou Tao

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='CAEf4Bzax=zdncGuNa_+AusYywxqNfSMmTERg_geP60UOm9oGkg@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.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=houtao@huaweicloud.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).