linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Yang Jihong <yangjihong1@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-perf-users <linux-perf-users@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] Adding support for setting the affinity of the recording process
Date: Mon, 12 Jun 2023 11:24:26 -0300	[thread overview]
Message-ID: <ZIcqmlHIfBbyZFDl@kernel.org> (raw)
In-Reply-To: <159de73b-fdd6-6df8-4f77-73c628fe641f@huawei.com>

Em Mon, Jun 12, 2023 at 06:26:10PM +0800, Yang Jihong escreveu:
> Hello everyone,
> 
> Currently, perf-record supports profiling an existing process, thread, or a
> specified command.
> 
> Sometimes we may need to set CPU affinity of the target process before
> recording:
> 
>   # taskset -pc <cpus> <pid>
>   # perf record -p <pid> -- sleep 10
> 
> or:
> 
>   # perf record -- `taskset -c <cpus> COMMAND`
> 
> I'm thinking about getting perf to support setting the affinity of the
> recording process, for example:

not of the 'recording process' but the 'observed process', right?
 
> 1. set the CPU affinity of the <pid1> process to <cpus1>, <pid2> process to
> <cpus2>,  and record:
> 
>   # perf record -p <pid1>/<cpus1>:<pid2>/<cpus2> -- sleep 10

but what would be the semantic for what is being observed? Would this
result in it recording events on that CPU or just for that process (that
now runs just on that CPU)?

Without affinity setting that could mean: observe just that process when
it runs on that CPU.

But could you please spell out the use case, why do you need this, is
this so common (for you) that you repeatedly need to first taskset, then
perf, etc?
 
> and
> 
> 2. set CPU affinity of the COMMAND and record:
> 
>   # perf record --taskset-command <cpus> COMMAND
> 
> In doing so, perf, as an observer, actually changes some of the properties
> of the target process, which may be contrary to the purpose of perf tool.

Up for discussion, but I don't think this is that much a problem if it
streamlines common observability sessions/experimentations.

> Will we consider accepting this approach?

- Arnaldo

  reply	other threads:[~2023-06-12 14:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 10:26 [RFC] Adding support for setting the affinity of the recording process Yang Jihong
2023-06-12 14:24 ` Arnaldo Carvalho de Melo [this message]
2023-06-12 15:05   ` Peter Zijlstra
2023-06-13  2:11     ` Yang Jihong
2023-06-13  2:03   ` Yang Jihong
2023-06-12 15:27 ` James Clark
2023-06-13  2:28   ` Yang Jihong
2023-06-13  5:50     ` Namhyung Kim
2023-06-13  7:03       ` Yang Jihong

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=ZIcqmlHIfBbyZFDl@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=yangjihong1@huawei.com \
    /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).