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]
Date:   Wed, 30 Oct 2019 11:05:54 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Andi Kleen <andi@...stfloor.org>
Cc:     acme@...nel.org, jolsa@...nel.org, eranian@...gle.com,
        linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v3 4/7] perf stat: Use affinity for closing file
 descriptors

On Fri, Oct 25, 2019 at 11:14:14AM -0700, Andi Kleen wrote:

SNIP

> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index da3c8f8ef68e..aeb82de36043 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -18,6 +18,7 @@
>  #include "debug.h"
>  #include "units.h"
>  #include <internal/lib.h> // page_size
> +#include "affinity.h"
>  #include "../perf.h"
>  #include "asm/bug.h"
>  #include "bpf-event.h"
> @@ -1170,9 +1171,33 @@ void perf_evlist__set_selected(struct evlist *evlist,
>  void evlist__close(struct evlist *evlist)
>  {
>  	struct evsel *evsel;
> +	struct affinity affinity;
> +	struct perf_cpu_map *cpus;
> +	int i, cpu;
> +
> +	if (!evlist->core.cpus) {
> +		evlist__for_each_entry_reverse(evlist, evsel)
> +			evsel__close(evsel);
> +		return;
> +	}
>  
> -	evlist__for_each_entry_reverse(evlist, evsel)
> -		evsel__close(evsel);
> +	if (affinity__setup(&affinity) < 0)
> +		return;
> +	cpus = evlist__cpu_iter_start(evlist);
> +	cpumap__for_each_cpu (cpus, i, cpu) {
> +		affinity__set(&affinity, cpu);

whats the point of affinity->changed flags when we call
affinity__set unconditionaly? I think we can do without
it, becase we'll always endup calling affinity__set

also here you're missing affinity__cleanup call in here

however, it seems superfluous to always allocate those
bitmaps, while we need just the current cpus that we
run on and also that is probably questionable

could we put 'struct affinity' to 'struct evlist'
and get rid of all affinity__setup/cleanup calls?
(apart from those in evlist__init and evlist__delete)

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ