From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3] perf bench sched pipe: Add -G/--cgroups option
Date: Tue, 17 Oct 2023 09:09:09 -0300 [thread overview]
Message-ID: <ZS55ZfRFGbQMIbbh@kernel.org> (raw)
In-Reply-To: <CAM9d7cjH+c30MChKyOpMNB6-k6Vy4F4ZbB1Eih0Dk5tgXP8mEg@mail.gmail.com>
Em Mon, Oct 16, 2023 at 02:44:23PM -0700, Namhyung Kim escreveu:
> On Mon, Oct 16, 2023 at 1:35 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > Em Mon, Oct 16, 2023 at 12:55:33PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Mon, Oct 16, 2023 at 12:51:52PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Now back at testing with with cgroups.
> >
> > > Humm, even without the -G I get:
> >
> > > [root@five ~]# perf stat -e context-switches,cgroup-switches perf bench sched pipe -l 10000
> > > # Running 'sched/pipe' benchmark:
> > > # Executed 10000 pipe operations between two processes
> >
> > > Total time: 0.082 [sec]
> >
> > > 8.246400 usecs/op
> > > 121265 ops/sec
> >
> > > Performance counter stats for 'perf bench sched pipe -l 10000':
> >
> > > 20,002 context-switches
> > > 20,002 cgroup-switches
> >
> > Same number, but then I forgot to add the 'taskset -c 0' part of the
> > command line, if I have it:
> >
> > [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.072 [sec]
> >
> > 7.231500 usecs/op
> > 138283 ops/sec
> >
> > Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000':
> >
> > 20,002 context-switches
> > 3 cgroup-switches
> >
> > 0.082855113 seconds time elapsed
> >
> > 0.007765000 seconds user
> > 0.074020000 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:
> > # Executed 10000 pipe operations between two processes
> >
> > Total time: 0.093 [sec]
> >
> > 9.341800 usecs/op
> > 107045 ops/sec
> >
> > Performance counter stats for 'taskset -c 0 perf bench sched pipe -l 10000 -G AAA,BBB':
> >
> > 20,004 context-switches
> > 20,003 cgroup-switches
> >
> > 0.103436330 seconds time elapsed
> >
> > 0.018109000 seconds user
> > 0.063058000 seconds sys
> >
> >
> > [root@five ~]#
> >
> > I.e. it works as in your results, but can you please spell out why that
> > 'taskset -c 0' is needed to get these results?
> >
> > I wasn't expecting the same number of cgroup-switches when not using
> > 'taskset -c 0' :-\
>
> Without taskset, each task is likely to run on different CPUs
> and other tasks (including idle) on that CPU would be in
> different cgroup so it'll create cgroup switches everytime
> if they run in AAA or BBB.
Sure, and the 'perf stat' is counting _just_ that workload and its
children (no -a).
Can you please add this to the cset commit log message? I.e. describe
the test setup thoroughly to help in reviewing and for us to quickly
understand what is being tested, the purpose of the test and how the
results match our expectations.
This will be specially helpful in the future, when we do bisects, try to
understand why changes were made, etc.
Even in the man page this information would be useful in helping users
to understand the purpose of the 'perf bench' -G option. So I think its
better to have it there instead of in the cset commit log message.
> With taskset, both sender and receiver would run on the
> same CPU. So it'd see the impact of cgroup switches
> with this option.
Thanks!
- Arnaldo
next prev parent reply other threads:[~2023-10-17 12:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 4:42 [PATCH v3] perf bench sched pipe: Add -G/--cgroups option Namhyung Kim
2023-10-16 9:35 ` Ingo Molnar
2023-10-16 15:38 ` Arnaldo Carvalho de Melo
2023-10-16 15:45 ` Arnaldo Carvalho de Melo
2023-10-16 15:51 ` Arnaldo Carvalho de Melo
2023-10-16 15:55 ` Arnaldo Carvalho de Melo
2023-10-16 20:34 ` Arnaldo Carvalho de Melo
2023-10-16 21:44 ` Namhyung Kim
2023-10-17 12:09 ` Arnaldo Carvalho de Melo [this message]
2023-10-17 11:40 ` Ingo Molnar
2023-10-17 12:28 ` [perf stat] Extend --cpu to non-system-wide runs too? was " Arnaldo Carvalho de Melo
2023-10-17 12:43 ` Ingo Molnar
2023-10-17 18:31 ` Arnaldo Carvalho de Melo
2023-10-17 19:05 ` Namhyung Kim
2023-10-18 12:07 ` Ingo Molnar
2023-10-17 8:06 ` Athira Rajeev
2023-10-16 17:25 ` Athira Rajeev
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=ZS55ZfRFGbQMIbbh@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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).