lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191203112335.GF17468@krava>
Date:   Tue, 3 Dec 2019 12:23:35 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Andi Kleen <ak@...ux.intel.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 3/3] perf record: adapt affinity to machines with
 #CPUs > 1K

On Tue, Dec 03, 2019 at 01:48:05PM +0300, Alexey Budankov wrote:
> 
> 
> On 03.12.2019 13:12, Jiri Olsa wrote:
> > On Mon, Dec 02, 2019 at 09:58:48AM +0300, Alexey Budankov wrote:
> > 
> > SNIP
> > 
> >>  
> >> -static void build_node_mask(int node, cpu_set_t *mask)
> >> +static void build_node_mask(int node, struct mmap_cpu_mask *mask)
> >>  {
> >>  	int c, cpu, nr_cpus;
> >>  	const struct perf_cpu_map *cpu_map = NULL;
> >> @@ -240,17 +242,23 @@ static void build_node_mask(int node, cpu_set_t *mask)
> >>  	for (c = 0; c < nr_cpus; c++) {
> >>  		cpu = cpu_map->map[c]; /* map c index to online cpu index */
> >>  		if (cpu__get_node(cpu) == node)
> >> -			CPU_SET(cpu, mask);
> >> +			set_bit(cpu, mask->bits);
> >>  	}
> >>  }
> >>  
> >> -static void perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params *mp)
> >> +static int perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params *mp)
> >>  {
> >> -	CPU_ZERO(&map->affinity_mask);
> >> +	map->affinity_mask.nbits = cpu__max_cpu();
> >> +	map->affinity_mask.bits = bitmap_alloc(map->affinity_mask.nbits);
> >> +	if (!map->affinity_mask.bits)
> >> +		return -1;
> > 
> > hum, this one should be also behind (rec->opts.affinity != PERF_AFFINITY_SYS)
> > condition, right? sry I haven't noticed that before..
> 
> That has not been so far, but, probably like this:
> 
> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
> index 7f573f646431..832d2cb94b2c 100644
> --- a/tools/perf/util/mmap.c
> +++ b/tools/perf/util/mmap.c
> @@ -269,7 +269,8 @@ int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu)
>                 return -1;
>         }
>  
> -       if (perf_mmap__setup_affinity_mask(map, mp)) {
> +       if (mp->affinity != PERF_AFFINITY_SYS &&
> +               perf_mmap__setup_affinity_mask(map, mp)) {
>                 pr_debug2("failed to alloc mmap affinity mask, error %d\n",
>                           errno);
>                 return -1;

yes, that works too

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ