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: <20191129130710.GB14169@krava>
Date:   Fri, 29 Nov 2019 14:07:10 +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 v3 3/3] perf record: adapt affinity to machines with
 #CPUs > 1K

On Fri, Nov 29, 2019 at 01:05:26PM +0300, Alexey Budankov wrote:

SNIP

>  # undef REASON
>  #endif
>  
> -	CPU_ZERO(&rec->affinity_mask);
>  	rec->opts.affinity = PERF_AFFINITY_SYS;
>  
>  	rec->evlist = evlist__new();
> @@ -2499,6 +2504,14 @@ int cmd_record(int argc, const char **argv)
>  
>  	symbol__init(NULL);
>  
> +	rec->affinity_mask.nbits = cpu__max_cpu();
> +	rec->affinity_mask.bits = bitmap_alloc(rec->affinity_mask.nbits);
> +	if (!rec->affinity_mask.bits) {
> +		pr_err("Failed to allocate thread mask for %ld cpus\n", rec->affinity_mask.nbits);
> +		return -ENOMEM;
> +	}
> +	pr_debug2("thread mask[%ld]: empty\n", rec->affinity_mask.nbits);

above can be done only for (rec->opts.affinity != PERF_AFFINITY_SYS)


> +
>  	err = record__auxtrace_init(rec);
>  	if (err)
>  		goto out;
> @@ -2613,6 +2626,8 @@ int cmd_record(int argc, const char **argv)
>  
>  	err = __cmd_record(&record, argc, argv);
>  out:
> +	if (rec->affinity_mask.bits)
> +		bitmap_free(rec->affinity_mask.bits);
>  	evlist__delete(rec->evlist);
>  	symbol__exit();
>  	auxtrace_record__free(rec->itr);
> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
> index 30ff7aef06f2..615d05870849 100644
> --- a/tools/perf/util/mmap.c
> +++ b/tools/perf/util/mmap.c
> @@ -219,6 +219,9 @@ static void perf_mmap__aio_munmap(struct mmap *map __maybe_unused)
>  
>  void mmap__munmap(struct mmap *map)
>  {
> +	if (map->affinity_mask.bits)
> +		bitmap_free(map->affinity_mask.bits);

you don't need to check map->affinity_mask.bits, it's checked in free

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ