From: JiangYu Date: Tue, 24 Nov 2020 03:19:39 +0000 (+0000) Subject: blk/kernel: expose IORING_SETUP_{IOPOLL,SQPOLL} as options X-Git-Tag: v16.1.0~471^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ccf97825a6b603157ce81991cd0d7b67e7301a4e;p=ceph.git blk/kernel: expose IORING_SETUP_{IOPOLL,SQPOLL} as options Signed-off-by: JiangYu --- diff --git a/src/blk/kernel/KernelDevice.cc b/src/blk/kernel/KernelDevice.cc index 58142b3c106a..e3ef9f155d80 100644 --- a/src/blk/kernel/KernelDevice.cc +++ b/src/blk/kernel/KernelDevice.cc @@ -70,7 +70,9 @@ KernelDevice::KernelDevice(CephContext* cct, aio_callback_t cb, void *cbpriv, ai unsigned int iodepth = cct->_conf->bdev_aio_max_queue_depth; if (use_ioring && ioring_queue_t::supported()) { - io_queue = std::make_unique(iodepth); + bool use_ioring_hipri = cct->_conf.get_val("bdev_ioring_hipri"); + bool use_ioring_sqthread_poll = cct->_conf.get_val("bdev_ioring_sqthread_poll"); + io_queue = std::make_unique(iodepth, use_ioring_hipri, use_ioring_sqthread_poll); } else { static bool once; if (use_ioring && !once) { diff --git a/src/blk/kernel/io_uring.cc b/src/blk/kernel/io_uring.cc index f248d38197a8..70fef32bd5c2 100644 --- a/src/blk/kernel/io_uring.cc +++ b/src/blk/kernel/io_uring.cc @@ -8,11 +8,6 @@ #include "liburing.h" #include -/* Options */ - -static bool hipri = false; /* use IO polling */ -static bool sq_thread = false; /* use kernel submission/poller thread */ - struct ioring_data { struct io_uring io_uring; pthread_mutex_t cq_mutex; @@ -108,9 +103,11 @@ static void build_fixed_fds_map(struct ioring_data *d, } } -ioring_queue_t::ioring_queue_t(unsigned iodepth_) : +ioring_queue_t::ioring_queue_t(unsigned iodepth_, bool hipri_, bool sq_thread_) : d(make_unique()), - iodepth(iodepth_) + iodepth(iodepth_), + hipri(hipri_), + sq_thread(sq_thread_) { } diff --git a/src/blk/kernel/io_uring.h b/src/blk/kernel/io_uring.h index f4ac2f6e12d8..e7d0acde0134 100644 --- a/src/blk/kernel/io_uring.h +++ b/src/blk/kernel/io_uring.h @@ -13,13 +13,15 @@ struct ioring_data; struct ioring_queue_t final : public io_queue_t { std::unique_ptr d; unsigned iodepth = 0; + bool hipri = false; + bool sq_thread = false; typedef std::list::iterator aio_iter; // Returns true if arch is x86-64 and kernel supports io_uring static bool supported(); - ioring_queue_t(unsigned iodepth_); + ioring_queue_t(unsigned iodepth_, bool hipri_, bool sq_thread_); ~ioring_queue_t() final; int init(std::vector &fds) final; diff --git a/src/common/options.cc b/src/common/options.cc index 806da4e1215a..7de01868ccfd 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -4791,6 +4791,14 @@ std::vector