From 72cd5da67c5c60d150ac4780acf8c3d81323b810 Mon Sep 17 00:00:00 2001 From: Jakub Wartak Date: Mon, 22 Sep 2025 10:00:47 +0200 Subject: [PATCH v2] aio: warn user if combined io_uring memory mappings are unavailable In f54af9f2 we have added solution to avoid connection and disconnection hit caused by io_uring managing large number of memory mappings. Unfortunately it is available only on more modern Linux kernels (6.5) therefore notify user in visible way if this optimization is not available. Author: Jakub Wartak Reviewed-by: Andres Freund Discussion: https://postgr.es/m/CAFbpF8OA44_UG+RYJcWH9WjF7E3GA6gka3gvH6nsrSnEe9H0NA@mail.gmail.com --- doc/src/sgml/config.sgml | 6 ++++++ src/backend/storage/aio/method_io_uring.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index e9b420f3ddb..15dd955a0c3 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2784,6 +2784,12 @@ include_dir 'conf.d' This parameter can only be set at server start. + + Note that for optimum performance with io_uring + Linux kernel version >= 6.5 is recommended. Older Linux versions, + high values of will slow down connection + establishment and termination. + diff --git a/src/backend/storage/aio/method_io_uring.c b/src/backend/storage/aio/method_io_uring.c index bb06da63a8e..36b9fabf7c5 100644 --- a/src/backend/storage/aio/method_io_uring.c +++ b/src/backend/storage/aio/method_io_uring.c @@ -207,8 +207,9 @@ pgaio_uring_check_capabilities(void) * pgaio_uring_shmem_init(). */ errno = -ret; - elog(DEBUG1, - "cannot use combined memory mapping for io_uring, ring creation failed: %m"); + ereport(WARNING, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("io_uring combined memory mapping creation failed: %m. Upgrade kernel to 6.5+ for improved performance"))); } @@ -217,8 +218,9 @@ pgaio_uring_check_capabilities(void) } #else { - elog(DEBUG1, - "can't use combined memory mapping for io_uring, kernel or liburing too old"); + ereport(WARNING, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("io_uring combined memory mapping creation failed: %m. Upgrade kernel to 6.5+ for improved performance"))); } #endif -- 2.39.5