linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Alexey Budankov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com,
	peterz@infradead.org, alexander.shishkin@linux.intel.com,
	alexey.budankov@linux.intel.com, namhyung@kernel.org,
	jolsa@redhat.com, mingo@kernel.org, acme@redhat.com,
	ak@linux.intel.com
Subject: [tip:perf/core] perf record: Implement --affinity=node|cpu option
Date: Fri, 15 Feb 2019 01:25:06 -0800	[thread overview]
Message-ID: <tip-f4fe11b7bf7ff6a1ccf15d7a9484f0ff7d1e92ae@git.kernel.org> (raw)
In-Reply-To: <083f5422-ece9-10dd-8305-bf59c860f10f@linux.intel.com>

Commit-ID:  f4fe11b7bf7ff6a1ccf15d7a9484f0ff7d1e92ae
Gitweb:     https://git.kernel.org/tip/f4fe11b7bf7ff6a1ccf15d7a9484f0ff7d1e92ae
Author:     Alexey Budankov <alexey.budankov@linux.intel.com>
AuthorDate: Tue, 22 Jan 2019 20:52:03 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 11 Feb 2019 12:32:21 -0300

perf record: Implement --affinity=node|cpu option

Implement --affinity=node|cpu option for the record mode defaulting
to system affinity mask bouncing.

Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/083f5422-ece9-10dd-8305-bf59c860f10f@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-record.txt |  5 +++++
 tools/perf/builtin-record.c              | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 02b4aa2621e7..8f0c2be34848 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -454,6 +454,11 @@ Use <n> control blocks in asynchronous (Posix AIO) trace writing mode (default:
 Asynchronous mode is supported only when linking Perf tool with libc library
 providing implementation for Posix AIO API.
 
+--affinity=mode::
+Set affinity mask of trace reading thread according to the policy defined by 'mode' value:
+  node - thread affinity mask is set to NUMA node cpu mask of the processed mmap buffer
+  cpu  - thread affinity mask is set to cpu of the processed mmap buffer
+
 --all-kernel::
 Configure all used events to run in kernel space.
 
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3fdfbaebd95e..6c3719ac901d 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1656,6 +1656,21 @@ static int parse_clockid(const struct option *opt, const char *str, int unset)
 	return -1;
 }
 
+static int record__parse_affinity(const struct option *opt, const char *str, int unset)
+{
+	struct record_opts *opts = (struct record_opts *)opt->value;
+
+	if (unset || !str)
+		return 0;
+
+	if (!strcasecmp(str, "node"))
+		opts->affinity = PERF_AFFINITY_NODE;
+	else if (!strcasecmp(str, "cpu"))
+		opts->affinity = PERF_AFFINITY_CPU;
+
+	return 0;
+}
+
 static int record__parse_mmap_pages(const struct option *opt,
 				    const char *str,
 				    int unset __maybe_unused)
@@ -1964,6 +1979,9 @@ static struct option __record_options[] = {
 		     &nr_cblocks_default, "n", "Use <n> control blocks in asynchronous trace writing mode (default: 1, max: 4)",
 		     record__aio_parse),
 #endif
+	OPT_CALLBACK(0, "affinity", &record.opts, "node|cpu",
+		     "Set affinity mask of trace reading thread to NUMA node cpu mask or cpu of processed mmap buffer",
+		     record__parse_affinity),
 	OPT_END()
 };
 

  reply	other threads:[~2019-02-15  9:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 17:45 [PATCH v5 0/4] Reduce NUMA related overhead in perf record profiling on large server systems Alexey Budankov
2019-01-22 17:47 ` [PATCH v5 1/4] perf record: allocate affinity masks Alexey Budankov
2019-02-09 12:45   ` [tip:perf/core] perf record: Allocate " tip-bot for Alexey Budankov
2019-01-22 17:48 ` [PATCH v5 2/4] perf record: bind the AIO user space buffers to nodes Alexey Budankov
2019-02-04 19:29   ` Arnaldo Carvalho de Melo
2019-02-04 19:47     ` Alexey Budankov
2019-02-05 15:15       ` Arnaldo Carvalho de Melo
2019-02-05 15:34         ` Alexey Budankov
2019-02-09 12:46         ` [tip:perf/core] perf record: Bind " tip-bot for Alexey Budankov
2019-01-22 17:50 ` [PATCH v5 3/4] perf record: apply affinity masks when reading mmap buffers Alexey Budankov
2019-02-09 12:47   ` [tip:perf/core] perf record: Apply " tip-bot for Alexey Budankov
2019-01-22 17:52 ` [PATCH v5 4/4] perf record: implement --affinity=node|cpu option Alexey Budankov
2019-02-15  9:25   ` tip-bot for Alexey Budankov [this message]
2019-01-28  7:13 ` [PATCH v5 0/4] Reduce NUMA related overhead in perf record profiling on large server systems Alexey Budankov
2019-01-28  8:20   ` Jiri Olsa
2019-01-28  8:39     ` Alexey Budankov
2019-01-28 11:27 ` Jiri Olsa
2019-01-31  9:52   ` Alexey Budankov
2019-02-01 16:31   ` Arnaldo Carvalho de Melo
2019-01-29  9:14 ` Arnaldo Carvalho de Melo
2019-01-29 10:22   ` Alexey Budankov

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=tip-f4fe11b7bf7ff6a1ccf15d7a9484f0ff7d1e92ae@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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).