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] [day] [month] [year] [list]
Message-ID: <5297BBB0.8030104@cn.fujitsu.com>
Date:	Thu, 28 Nov 2013 16:54:56 -0500
From:	Dongsheng Yang <yangds.fnst@...fujitsu.com>
To:	Dongsheng Yang <yangds.fnst@...fujitsu.com>
CC:	linux-kernel@...r.kernel.org, dsahern@...il.com,
	adrian.hunter@...el.com, jolsa@...hat.com, namhyung@...nel.org,
	acme@...stprotocols.net, mingo@...hat.com, a.p.zijlstra@...llo.nl
Subject: Re: [PATCH] perf target: Move what map fucntion to call check into
 function.

I will resend the correct one. Sorry for the bother.

On 11/28/2013 02:32 PM, Dongsheng Yang wrote:
> Check for cpu_map__dummy_new() or cpu_map__new() to be called in
> perf_evlist__create_maps() is more complicated. This patch moves
> the checking work into target.h, combining two conditions and making
> perf_evlist__create_maps() more readable.
>
> Signed-off-by: Dongsheng Yang <yangds.fnst@...fujitsu.com>
> ---
>   tools/perf/util/evlist.c |  8 +-------
>   tools/perf/util/target.h | 13 +++++++++++++
>   2 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 76fa764..7bb6ee1 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -819,13 +819,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
>   	if (evlist->threads == NULL)
>   		return -1;
>   
> -	if (target->default_per_cpu)
> -		evlist->cpus = target->per_thread ?
> -					cpu_map__dummy_new() :
> -					cpu_map__new(target->cpu_list);
> -	else if (target__has_task(target))
> -		evlist->cpus = cpu_map__dummy_new();
> -	else if (!target__has_cpu(target) && !target->uses_mmap)
> +	if (target__uses_dummy_map(target))
>   		evlist->cpus = cpu_map__dummy_new();
>   	else
>   		evlist->cpus = cpu_map__new(target->cpu_list);
> diff --git a/tools/perf/util/target.h b/tools/perf/util/target.h
> index 31dd2e9..7381b1c 100644
> --- a/tools/perf/util/target.h
> +++ b/tools/perf/util/target.h
> @@ -63,4 +63,17 @@ static inline bool target__none(struct target *target)
>   	return !target__has_task(target) && !target__has_cpu(target);
>   }
>   
> +static inline bool target__uses_dummy_map(struct target *target)
> +{
> +	bool use_dummy = false;
> +
> +	if (target->default_per_cpu)
> +		use_dummy = target->per_thread ? true : false;
> +	else if (target__has_task(target) ||
> +	         (!target__has_cpu(target) && !target->uses_mmap))
> +		use_dummy = true;
> +
> +	return use_dummy;
> +}
> +
>   #endif /* _PERF_TARGET_H */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ