Re: [PATCH v4] perf bench sched pipe: Add -G/--cgroups option

From: Namhyung Kim
Date: Fri Oct 20 2023 - 17:14:10 EST


On Fri, Oct 20, 2023 at 1:32 PM Arnaldo Carvalho de Melo
<acme@xxxxxxxxxx> wrote:
>
> Em Tue, Oct 17, 2023 at 01:23:42PM -0700, Namhyung Kim escreveu:
> > The -G/--cgroups option is to put sender and receiver in different
> > cgroups in order to measure cgroup context switch overheads.
> <SNIP>
> > > taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB > /dev/null
>
> > Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB':
> >
> > 20,001 context-switches
> > 20,001 cgroup-switches
>
> Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

Thanks a lot Arnaldo!

Ingo, can I keep you Acked-by here? (forgot to add in v4, sorry!)

Thanks,
Namhyung

>
> [root@five ~]# perf stat -e context-switches,cgroup-switches taskset -c 0 perf bench sched pipe -l 10000
> # Running 'sched/pipe' benchmark:
> # Executed 10000 pipe operations between two processes
>
> Total time: 0.063 [sec]
>
> 6.367500 usecs/op
> 157047 ops/sec
>
> Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000':
>
> 20,004 context-switches
> 4 cgroup-switches
>
> 0.084191842 seconds time elapsed
>
> 0.008332000 seconds user
> 0.067193000 seconds sys
>
>
> [root@five ~]# perf stat -e context-switches,cgroup-switches taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB
> # Running 'sched/pipe' benchmark:
> no access to cgroup /sys/fs/cgroup/BBB
> Failed to open cgroup file in BBB
> Hint: create the cgroup first, like 'mkdir /sys/fs/cgroup/BBB'
> no access to cgroup /sys/fs/cgroup/AAA
> Failed to open cgroup file in AAA
> Hint: create the cgroup first, like 'mkdir /sys/fs/cgroup/AAA'
>
> Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB':
>
> 2 context-switches
> 1 cgroup-switches
>
> 0.010356533 seconds time elapsed
>
> 0.003209000 seconds user
> 0.007122000 seconds sys
>
>
> [root@five ~]# vim /tmp/bla
> [root@five ~]#
> [root@five ~]# mkdir /sys/fs/cgroup/BBB /sys/fs/cgroup/AAA
> [root@five ~]# perf stat -e context-switches,cgroup-switches taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB
> # Running 'sched/pipe' benchmark:
> # Executed 10000 pipe operations between two processes
>
> Total time: 0.079 [sec]
>
> 7.987800 usecs/op
> 125190 ops/sec
>
> Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB':
>
> 20,008 context-switches
> 20,007 cgroup-switches
>
> 0.089361029 seconds time elapsed
>
> 0.009004000 seconds user
> 0.065376000 seconds sys
>
>
> [root@five ~]#