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: <3666b3e081d50de57d8669530eec59ed8be0c841.1629454773.git.rickyman7@gmail.com>
Date:   Fri, 20 Aug 2021 12:53:58 +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 12/15] perf record: setup global workqueue

This patch initializes the global workqueue in perf-record if
nr_threads_synthesize is set.

This patch is a preparation for using the global_workqueue in
synthesize.

Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
---
 tools/perf/builtin-record.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 548c1dbde6c52ed6..4d7b610b1d0bb9af 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -49,6 +49,7 @@
 #include "util/clockid.h"
 #include "util/pmu-hybrid.h"
 #include "util/evlist-hybrid.h"
+#include "util/workqueue/workqueue.h"
 #include "asm/bug.h"
 #include "perf.h"
 
@@ -2894,7 +2895,21 @@ int cmd_record(int argc, const char **argv)
 		rec->opts.comp_level = comp_level_max;
 	pr_debug("comp level: %d\n", rec->opts.comp_level);
 
+	if (rec->opts.nr_threads_synthesize == UINT_MAX)
+		rec->opts.nr_threads_synthesize = sysconf(_SC_NPROCESSORS_ONLN);
+	if (rec->opts.nr_threads_synthesize > 1) {
+		err = setup_global_workqueue(rec->opts.nr_threads_synthesize);
+		if (err) {
+			create_workqueue_strerror(global_wq, errbuf, sizeof(errbuf));
+			pr_err("setup_global_workqueue: %s\n", errbuf);
+			goto out;
+		}
+	}
+
 	err = __cmd_record(&record, argc, argv);
+
+	if (rec->opts.nr_threads_synthesize > 1)
+		teardown_global_workqueue();
 out:
 	bitmap_free(rec->affinity_mask.bits);
 	evlist__delete(rec->evlist);
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ