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: <20180917113131.GD18395@sejong>
Date:   Mon, 17 Sep 2018 20:31:31 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     Jiri Olsa <jolsa@...nel.org>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Andi Kleen <andi@...stfloor.org>,
        Alexey Budankov <alexey.budankov@...ux.intel.com>,
        kernel-team@....com
Subject: Re: [PATCH 39/48] perf record: Move waking into struct record

On Thu, Sep 13, 2018 at 02:54:41PM +0200, Jiri Olsa wrote:
> We need to keep global number of 'waking' now.
> 
> TODO: make this multiple threads safe.

Why not using atomic APIs?

Thanks,
Namhyung


> 
> Link: http://lkml.kernel.org/n/tip-veetgk62aisdt1cxaa6fbgox@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  tools/perf/builtin-record.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index d6fef646b67f..62ff4411ce39 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -94,6 +94,7 @@ struct record {
>  	unsigned long long	samples;
>  	struct record_thread	*threads;
>  	int			threads_cnt;
> +	unsigned long		waking;
>  };
>  
>  static __thread struct record_thread *thread;
> @@ -1143,7 +1144,6 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>  {
>  	int err;
>  	int status = 0;
> -	unsigned long waking = 0;
>  	const bool forks = argc > 0;
>  	struct perf_tool *tool = &rec->tool;
>  	struct record_opts *opts = &rec->opts;
> @@ -1400,8 +1400,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>  
>  			if (!quiet)
>  				fprintf(stderr, "[ perf record: dump data: Woken up %ld times ]\n",
> -					waking);
> -			waking = 0;
> +					rec->waking);
> +			rec->waking = 0;
>  			fd = record__switch_output(rec, false);
>  			if (fd < 0) {
>  				pr_err("Failed to switch to new file\n");
> @@ -1425,7 +1425,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>  			 */
>  			if (err > 0 || (err < 0 && errno == EINTR))
>  				err = 0;
> -			waking++;
> +			rec->waking++;
>  
>  			if (perf_evlist__filter_pollfd(rec->evlist, POLLERR | POLLHUP) == 0)
>  				draining = true;
> @@ -1454,7 +1454,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>  	}
>  
>  	if (!quiet)
> -		fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking);
> +		fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", rec->waking);
>  
>  	if (target__none(&rec->opts.target))
>  		record__synthesize_workload(rec, true);
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ