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: <17b1c402f4a2f82f784ef40de6c7b62d8c6846ed.1629454773.git.rickyman7@gmail.com>
Date:   Fri, 20 Aug 2021 12:54:00 +0200
From:   Riccardo Mancini <rickyman7@...il.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Ian Rogers <irogers@...gle.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
        linux-perf-users@...r.kernel.org,
        Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>,
        Riccardo Mancini <rickyman7@...il.com>
Subject: [RFC PATCH v3 14/15] perf test/synthesis: setup global workqueue

This patch sets up the global workqueue in the synthesis test.
The next patch will use it for synthesis.

Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
---
 tools/perf/bench/synthesize.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/perf/bench/synthesize.c b/tools/perf/bench/synthesize.c
index 05f7c923c745b4e8..738821113a005a6c 100644
--- a/tools/perf/bench/synthesize.c
+++ b/tools/perf/bench/synthesize.c
@@ -16,6 +16,7 @@
 #include "../util/thread_map.h"
 #include "../util/tool.h"
 #include "../util/util.h"
+#include "../util/workqueue/workqueue.h"
 #include <linux/atomic.h>
 #include <linux/err.h>
 #include <linux/time64.h>
@@ -208,6 +209,7 @@ static int run_multi_threaded(void)
 	};
 	unsigned int nr_threads_synthesize;
 	int err;
+	char errbuf[BUFSIZ];
 
 	if (max_threads == UINT_MAX)
 		max_threads = sysconf(_SC_NPROCESSORS_ONLN);
@@ -219,10 +221,17 @@ static int run_multi_threaded(void)
 	for (nr_threads_synthesize = min_threads;
 	     nr_threads_synthesize <= max_threads;
 	     nr_threads_synthesize++) {
-		if (nr_threads_synthesize == 1)
+		if (nr_threads_synthesize == 1) {
 			perf_set_singlethreaded();
-		else
+		} else {
+			err = setup_global_workqueue(nr_threads_synthesize);
+			if (err) {
+				create_workqueue_strerror(global_wq, errbuf, sizeof(errbuf));
+				pr_err("setup_global_workqueue: %s\n", errbuf);
+				return err;
+			}
 			perf_set_multithreaded();
+		}
 
 		printf("  Number of synthesis threads: %u\n",
 			nr_threads_synthesize);
@@ -230,6 +239,9 @@ static int run_multi_threaded(void)
 		err = do_run_multi_threaded(&target, nr_threads_synthesize);
 		if (err)
 			return err;
+
+		if (nr_threads_synthesize > 1)
+			teardown_global_workqueue();
 	}
 	perf_set_singlethreaded();
 	return 0;
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ