diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-25 09:42:38 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-25 09:42:38 +0200 |
commit | 6479006e14691ff85072d06682f81b90875e9cb0 (patch) | |
tree | d149050786d1ce0dcc1b09058b35de0c52611d2c /tpool | |
parent | 7a9405e3dc8741d50658e976b7e16c1807c2b9a7 (diff) | |
download | mariadb-git-6479006e14691ff85072d06682f81b90875e9cb0.tar.gz |
MDEV-24270: Collect multiple completed events at a time
tpool::aio::N_PENDING: Replaces OS_AIO_N_PENDING_IOS_PER_THREAD.
This limits two similar things: the number of outstanding requests
that a thread may io_submit(), and the number of completed requests
collected at a time by io_getevents().
Diffstat (limited to 'tpool')
-rw-r--r-- | tpool/aio_linux.cc | 11 | ||||
-rw-r--r-- | tpool/tpool.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc index 51b656a604b..cb967c117e4 100644 --- a/tpool/aio_linux.cc +++ b/tpool/aio_linux.cc @@ -60,27 +60,26 @@ class aio_linux final : public aio static void getevent_thread_routine(aio_linux *aio) { - io_event events[1]; + io_event events[N_PENDING]; for (;;) { - switch (int ret= my_getevents(aio->m_io_ctx, 1, 1, events)) { + switch (int ret= my_getevents(aio->m_io_ctx, 1, N_PENDING, events)) { case -EINTR: - case 0: continue; case -EINVAL: if (shutdown_in_progress) return; /* fall through */ default: - if (ret != 1) + if (ret < 0) { fprintf(stderr, "io_getevents returned %d\n", ret); abort(); return; } - else + for (int i= 0; i < ret; i++) { - const io_event &event= events[0]; + const io_event &event= events[i]; aiocb *iocb= static_cast<aiocb*>(event.obj); if (static_cast<int>(event.res) < 0) { diff --git a/tpool/tpool.h b/tpool/tpool.h index 0d83af5bd74..a2f9a9133cb 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -155,6 +155,8 @@ struct aiocb class aio { public: + /** Maximum number of pending requests per thread */ + static constexpr unsigned N_PENDING= 256; /** Submit asyncronous IO. On completion, cb->m_callback is executed. |