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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d11eb388-2a66-c791-3ad3-40eed930480a@linux.intel.com>
Date:   Fri, 29 Nov 2019 18:49:25 +0300
From:   Alexey Budankov <alexey.budankov@...ux.intel.com>
To:     Jiri Olsa <jolsa@...hat.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 29.11.2019 16:07, Jiri Olsa wrote:
> 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)

Indeed. Corrected in v4.

> 
> 
>> +
>>  	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

Makes sense. Corrected in v4.

> 
> jirka

Thanks,
Alexey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ