Re: [PATCH] check kernel version for io_method

Steven Niu <niushiji@gmail.com>

From: Steven Niu <niushiji@gmail.com>
To: Andreas Karlsson <andreas@proxel.se>, Pierre <pierre.forstmann@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-14T02:31:24Z
Lists: pgsql-hackers
From: Andreas Karlsson <andreas@proxel.se>
Sent: Wednesday, January 14, 2026 09:07
To: Pierre <pierre.forstmann@gmail.com>; pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: [PATCH] check kernel version for io_method


On 1/13/26 11:05 PM, Pierre wrote:
> Please find a patch proposal for bug BUG #19369: Not documented that 
> io_uring on kernel versions between 5.1 and below 5.6 does not work.
Wouldn't it make more sense to use io_uring_get_probe_ring() and 
io_uring_opcode_supported() to actually check for the required opcode? 
Then if someone uses a Kernel with the required features backported 
everything will still work.

Andreas

+1 
It would be more reliable to check the availability of io_uring feature than to check OS version. 

BTW, the error message in the following code block is wrong as it locates in branch that IO_URING is not enabled. 

#else
+	if (*newval == IOMETHOD_WORKER || *newval == IOMETHOD_SYNC)
+	{
+		/*
+		 * OK
+		 */
+	} 
+	else 
+	{
+		GUC_check_errdetail("io_uring requires Linux kernel 5.6 or later.");
+		return false;
+	}



Thanks,
Steven