[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190109165330.GC19455@krava>
Date: Wed, 9 Jan 2019 17:53:30 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 3/4] perf record: apply affinity masks when reading
mmap buffers
On Wed, Jan 09, 2019 at 12:38:23PM +0300, Alexey Budankov wrote:
SNIP
> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
> index e5220790f1fb..ee0230eed635 100644
> --- a/tools/perf/util/mmap.c
> +++ b/tools/perf/util/mmap.c
> @@ -377,6 +377,24 @@ void perf_mmap__munmap(struct perf_mmap *map)
> auxtrace_mmap__munmap(&map->auxtrace_mmap);
> }
>
> +static void perf_mmap__setup_affinity_mask(struct perf_mmap *map, struct mmap_params *mp)
> +{
> + int c, cpu, nr_cpus, node;
> +
> + CPU_ZERO(&map->affinity_mask);
> + if (mp->affinity == PERF_AFFINITY_NODE && cpu__max_node() > 1) {
> + nr_cpus = cpu_map__nr(mp->cpu_map);
> + node = cpu__get_node(map->cpu);
> + for (c = 0; c < nr_cpus; c++) {
> + cpu = mp->cpu_map->map[c]; /* map c index to online cpu index */
> + if (cpu__get_node(cpu) == node)
> + CPU_SET(cpu, &map->affinity_mask);
should we do that from from all possible cpus task (perf record)
can run on, instead of mp->cpu_map, which might be only subset
(-C ... option)
also node -> cpu_map is static configuration, we could prepare
this map ahead (like cpunode_map) and just assign it in here
based on node index
thanks,
jirka
Powered by blists - more mailing lists