Skip to content
Snippets Groups Projects
Commit a61972a5 authored by Florian Schmaus's avatar Florian Schmaus
Browse files

Merge branch 'shared-wq' into 'master'

[IO] add option to use a common async backend for all io_urings

See merge request i4/manycore/emper!94
parents 8fcadea9 6bbd0099
No related branches found
No related tags found
No related merge requests found
Pipeline #58208 passed
......@@ -89,4 +89,12 @@ static const bool IO_URING_SQPOLL =
false
#endif
;
static const bool IO_URING_SHARED_WQ =
#ifdef EMPER_IO_URING_SHARED_WQ
true
#else
false
#endif
;
} // namespace emper
......@@ -58,7 +58,7 @@ class Runtime : public Logger<LogSubsystem::RUNTI> {
ContextManager& contextManager;
pthread_t* threads;
Worker** workers;
IoContext* globalIo;
IoContext* globalIo = nullptr;
IoContext* ioContexts;
std::default_random_engine randomEngine;
......
......@@ -351,6 +351,14 @@ IoContext::IoContext(size_t uring_entries) {
params.flags |= IORING_SETUP_SQPOLL;
}
if constexpr (emper::IO_URING_SHARED_WQ) {
auto *gio = getGlobalIo();
if (gio) {
params.flags |= IORING_SETUP_ATTACH_WQ;
params.wq_fd = gio->ring.ring_fd;
}
}
auto ret = io_uring_queue_init_params(uring_entries, &ring, &params);
if (ret < 0) {
DIE_MSG_ERRNO("io_uring_queue_init failed");
......
......@@ -56,6 +56,7 @@ endif
io_bool_options = [
'uring_sqpoll',
'uring_shared_wq',
]
io_raw_options = [
......
......@@ -92,3 +92,9 @@ option(
value: false,
description: 'Enable io_urings SQPOLL feature (start a separate kernel thread which polls the sq reducing the amount of syscalls to submit new requests. This is a privileged operation.).'
)
option(
'io_uring_shared_wq',
type: 'boolean',
value: false,
description: 'Share a common async backend between all io_urings'
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment