[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cg75rnPpOUB4wUqUPCbsEZucOyu0sB1UwF3kk-4E8q2SA@mail.gmail.com>
Date: Fri, 13 Oct 2023 16:10:35 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...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
On Fri, Oct 13, 2023 at 4:03 PM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> 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:
> > > -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]#
Hmm... I don't know, I've tested it on v1 only ;-p I'll take a look.
Also I found a bug, will fix too.
Thanks,
Namhyung
diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
index 1103fd658d5d..25236f339b90 100644
--- a/tools/perf/bench/sched-pipe.c
+++ b/tools/perf/bench/sched-pipe.c
@@ -118,9 +118,9 @@ static void enter_cgroup(struct cgroup *cgrp)
/* try cgroup v2 interface first */
if (threaded)
- fd = openat(cgrp->fd, "cgroup.procs", O_WRONLY);
- else
fd = openat(cgrp->fd, "cgroup.threads", O_WRONLY);
+ else
+ fd = openat(cgrp->fd, "cgroup.progs", O_WRONLY);
/* try cgroup v1 if failed */
if (fd < 0)
Powered by blists - more mailing lists