lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZSnMxtnt7o5mLj+w@kernel.org>
Date:   Fri, 13 Oct 2023 20:03:34 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-perf-users@...r.kernel.org
Subject: Re: [PATCH] perf bench sched pipe: Add -G/--cgroups option

Em Fri, Oct 13, 2023 at 03:57:27PM -0700, Namhyung Kim escreveu:
> Hi Arnaldo,
> 
> On Fri, Oct 13, 2023 at 3:41 PM Arnaldo Carvalho de Melo
> <acme@...nel.org> wrote:
> >
> > Em Wed, Oct 04, 2023 at 01:47:41PM -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.
> > >
> > > Users need to make sure the cgroups exist and accessible.
> > >
> > >   # perf stat -e context-switches,cgroup-switches \
> > >   > taskset -c 0 perf bench sched pipe -l 10000 > /dev/null
> > >
> > >    Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000':
> > >
> > >               20,001      context-switches
> > >                    2      cgroup-switches
> > >
> > >          0.053449651 seconds time elapsed
> > >
> > >          0.011286000 seconds user
> > >          0.041869000 seconds sys
> > >
> > >   # perf stat -e context-switches,cgroup-switches \
> > >   > 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
> > >
> > >          0.052768627 seconds time elapsed
> >
> > So I tried with:
> >
> > [root@...co ~]# perf bench sched pipe -G system.slice,user.slice
> > # Running 'sched/pipe' benchmark:
> > cannot enter to cgroup: system.slice
> > cannot enter to cgroup: user.slice
> > # Executed 1000000 pipe operations between two processes
> >
> >      Total time: 6.301 [sec]
> >
> >        6.301478 usecs/op
> >          158692 ops/sec
> > [root@...co ~]#
> >
> > Should't it bail out when not managing to enter the cgroups?
> 
> Hmm.. right.  Will fix.
> 
> >
> > Also:
> >
> > [root@...co ~]# mkdir /sys/fs/cgroup/AAA
> > [root@...co ~]# mkdir /sys/fs/cgroup/BBB
> > [root@...co ~]#
> > [root@...co ~]# perf bench sched pipe -G AAA,BBB
> > # Running 'sched/pipe' benchmark:
> > cannot enter to cgroup: AAA
> > cannot enter to cgroup: BBB
> > # Executed 1000000 pipe operations between two processes
> >
> >      Total time: 6.397 [sec]
> >
> >        6.397830 usecs/op
> >          156302 ops/sec
> > [root@...co ~]#
> >
> > -rw-r--r--. 1 root root 0 Oct 13 19:22 /sys/fs/cgroup/AAA/cgroup.procs
> > [root@...co ~]# ls -la /sys/fs/cgroup/AAA/cgroup.threads
> > -rw-r--r--. 1 root root 0 Oct 13 19:22 /sys/fs/cgroup/AAA/cgroup.threads
> > [root@...co ~]# ls -la /sys/fs/cgroup/BBB/cgroup.threads
> > -rw-r--r--. 1 root root 0 Oct 13 19:22 /sys/fs/cgroup/BBB/cgroup.threads
> > [root@...co ~]# ls -la /sys/fs/cgroup/BBB/cgroup.procs
> > -rw-r--r--. 1 root root 0 Oct 13 19:22 /sys/fs/cgroup/BBB/cgroup.procs
> > [root@...co ~]#
> >
> > [root@...co ~]# perf bench sched pipe -G AAA,BBB
> > # Running 'sched/pipe' benchmark:
> > cannot enter to cgroup: AAA (written=-1, len=6, errno=Operation not supported)
> > cannot enter to cgroup: BBB (written=-1, len=6, errno=Operation not supported)
> > # Executed 1000000 pipe operations between two processes
> >
> >      Total time: 6.303 [sec]
> >
> >        6.303221 usecs/op
> >          158649 ops/sec
> > [root@...co ~]#
> >
> > I'm certainly missing something here :-\
> 
> Try to enable some cgroup controllers first.  Like
> 
>   # echo +cpu > /sys/fs/cgroup/AAA/cgroup.subtree_control
>   # echo +cpu > /sys/fs/cgroup/BBB/cgroup.subtree_control

[root@...co cgroup]# echo +cpu > /sys/fs/cgroup/AAA/cgroup.subtree_control
[root@...co cgroup]# echo +cpu > /sys/fs/cgroup/BBB/cgroup.subtree_control
[root@...co cgroup]# perf bench sched pipe -G AAA,BBB
# Running 'sched/pipe' benchmark:
cannot enter to cgroup: AAA (written=-1, len=6, errno=Operation not supported)
cannot enter to cgroup: BBB (written=-1, len=6, errno=Operation not supported)
# Executed 1000000 pipe operations between two processes

     Total time: 6.267 [sec]

       6.267680 usecs/op
         159548 ops/sec
[root@...co cgroup]# cat /sys/fs/cgroup/AAA/cgroup.subtree_control
cpu
[root@...co cgroup]# cat /sys/fs/cgroup/BBB/cgroup.subtree_control
cpu
[root@...co cgroup]# uname -a
Linux quaco 6.5.6-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Oct  6 19:02:35 UTC 2023 x86_64 GNU/Linux
[root@...co cgroup]#

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ