summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2021-04-13 20:54:37 +1000
committerDaniel Black <daniel@mariadb.org>2021-04-14 11:12:24 +1000
commit4cc5c32ec9b8286095fb34d07b1d43aefdd8541b (patch)
tree4fc1c80638d8258fc97f585694cd53428864d975
parentf74704c7d963ddcd1109843a5861c6bd76409c8d (diff)
downloadmariadb-git-st-10.6-iouring_required-memlock.tar.gz
io_liburing: ENOMEM handling - use io_uring_mlock_sizest-10.6-iouring_required-memlock
This gives the user the size required and how to set memlock limits for the process. Also don't put \n on my_printf_error, its implicit.
-rw-r--r--tpool/CMakeLists.txt10
-rw-r--r--tpool/aio_liburing.cc22
2 files changed, 26 insertions, 6 deletions
diff --git a/tpool/CMakeLists.txt b/tpool/CMakeLists.txt
index 69440d09490..3a49ea22837 100644
--- a/tpool/CMakeLists.txt
+++ b/tpool/CMakeLists.txt
@@ -17,6 +17,16 @@ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
LINK_LIBRARIES(${URING_LIBRARIES})
INCLUDE_DIRECTORIES(${URING_INCLUDE_DIR})
SET(EXTRA_SOURCES aio_liburing.cc)
+ SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
+ SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
+ SET(CMAKE_REQUIRED_INCLUDES ${URING_INCLUDE_DIR})
+ SET(CMAKE_REQUIRED_LIBRARIES ${URING_LIBRARIES})
+ CHECK_SYMBOL_EXISTS(io_uring_mlock_size "liburing.h" HAVE_IO_URING_MLOCK_SIZE)
+ SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
+ IF(HAVE_IO_URING_MLOCK_SIZE)
+ SET_SOURCE_FILES_PROPERTIES(aio_liburing.cc PROPERTIES COMPILE_FLAGS "-DHAVE_IO_URING_MLOCK_SIZE")
+ ENDIF()
ELSE()
FIND_PACKAGE(LIBAIO QUIET ${LIBAIO_REQUIRED})
IF(LIBAIO_FOUND)
diff --git a/tpool/aio_liburing.cc b/tpool/aio_liburing.cc
index 14219f1d499..bdc3601ae35 100644
--- a/tpool/aio_liburing.cc
+++ b/tpool/aio_liburing.cc
@@ -37,17 +37,27 @@ public:
{
switch (const auto e= errno) {
case ENOMEM:
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "io_uring_queue_init() failed with ENOMEM:"
+ " try larger memory locked limit, ulimit -l"
+ ", or https://mariadb.com/kb/en/systemd/#configuring-limitmemlock"
+ " under systemd"
+#ifdef HAVE_IO_URING_MLOCK_SIZE
+ " (%zd bytes required)", ME_ERROR_LOG | ME_WARNING,
+ io_uring_mlock_size(max_aio, 0));
+#else
+ , ME_ERROR_LOG | ME_WARNING);
+#endif
+ break;
case ENOSYS:
- my_printf_error(ER_UNKNOWN_ERROR, e == ENOMEM
- ? "io_uring_queue_init() failed with ENOMEM:"
- " try larger ulimit -l\n"
- : "io_uring_queue_init() failed with ENOSYS:"
- " try uprading the kernel\n",
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "io_uring_queue_init() failed with ENOSYS:"
+ " try uprading the kernel",
ME_ERROR_LOG | ME_WARNING);
break;
default:
my_printf_error(ER_UNKNOWN_ERROR,
- "io_uring_queue_init() failed with errno %d\n",
+ "io_uring_queue_init() failed with errno %d",
ME_ERROR_LOG | ME_WARNING, e);
}
throw std::runtime_error("aio_uring()");