From ad7c856e964b614507a06342c2acbf10bfa4855c Mon Sep 17 00:00:00 2001 From: Jakub Wartak Date: Tue, 9 Sep 2025 14:30:48 +0200 Subject: [PATCH v1] 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: 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 | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 2a3685f474a..9d541999dc1 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, as it provides way to + reduce the number of additional memory mappings which may negatively + affect the efficiency of establishing and terminating connections. + diff --git a/src/backend/storage/aio/method_io_uring.c b/src/backend/storage/aio/method_io_uring.c index bb06da63a8e..5cd839df2f3 100644 --- a/src/backend/storage/aio/method_io_uring.c +++ b/src/backend/storage/aio/method_io_uring.c @@ -207,8 +207,11 @@ 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("cannot use combined memory mapping for io_uring, ring creation failed: %m"), + errdetail("Connection and disconnection rates and efficiency may be degraded."), + errhint("Ensure that you are running kernel >= 6.5"))); } @@ -217,8 +220,11 @@ 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("cannot use combined memory mapping for io_uring, kernel or liburing too old"), + errdetail("Connection and disconnection rates and efficiency may be degraded."), + errhint("Ensure that you are running kernel >= 6.5"))); } #endif -- 2.39.5