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, 27 Sep 2017 13:44:52 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     kan.liang@...el.com
Cc:     acme@...nel.org, peterz@...radead.org, mingo@...hat.com,
        linux-kernel@...r.kernel.org, jolsa@...nel.org,
        namhyung@...nel.org, adrian.hunter@...el.com,
        lukasz.odzioba@...el.com, ak@...ux.intel.com
Subject: Re: [PATCH RFC V3 3/5] perf top: implement multithreading for
 perf_event__synthesize_threads

On Mon, Sep 25, 2017 at 01:23:06PM -0700, kan.liang@...el.com wrote:

SNIP

> +
> +int perf_event__synthesize_threads(struct perf_tool *tool,
> +				   perf_event__handler_t process,
> +				   struct machine *machine,
> +				   bool mmap_data,
> +				   unsigned int proc_map_timeout,
> +				   unsigned int nr_threads_synthesize)
> +{
> +	struct synthesize_threads_arg *args = NULL;
> +	pthread_t *synthesize_threads = NULL;
> +	char proc_path[PATH_MAX];
> +	struct dirent **dirent;
> +	int num_per_thread;
> +	int m, n, i, j;
> +	int thread_nr;
> +	int base = 0;
> +	int err = -1;
> +
> +
> +	if (machine__is_default_guest(machine))
> +		return 0;
> +
> +	snprintf(proc_path, sizeof(proc_path), "%s/proc", machine->root_dir);
> +	n = scandir(proc_path, &dirent, 0, alphasort);
> +	if (n < 0)
> +		return err;
> +
> +	thread_nr = nr_threads_synthesize;
> +	if (thread_nr <= 0)
> +		thread_nr = 1;

given the number of callers with 'nr_threads_synthesize == 1',
could you just make it the special case in here, like:

	if (thread_nr == 1)
		return __perf_event__synthesize_threads

looks like all the args are ready at this time

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ