On Mon, Jun 12, 2023 at 4:17 PM Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > > On Fri, Jun 9, 2023 at 9:12 AM Alexei Starovoitov > <alexei.starovoitov@xxxxxxxxx> wrote: > > > > On Thu, Jun 8, 2023 at 11:32 PM Hou Tao <houtao@xxxxxxxxxxxxxxx> 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?