| 1 |
From ac16a6beca118439eccb80b03d4925bd898707ae Mon Sep 17 00:00:00 2001 |
| 2 |
From: Yuri Konotopov <[email protected]> |
| 3 |
Date: Sat, 29 Aug 2026 07:34:37 +0000 |
| 4 |
Subject: [PATCH 5/5] Fixed SQPOLL fallback on permission errors |
| 5 |
|
| 6 |
Signed-off-by: Yuri Konotopov <[email protected]> |
| 7 |
|
| 8 |
Forwarded: https://github.com/mosquito/caio/pull/76 |
| 9 |
--- |
| 10 |
caio/linux_uring.c | 6 +++--- |
| 11 |
1 file changed, 3 insertions(+), 3 deletions(-) |
| 12 |
|
| 13 |
diff --git a/caio/linux_uring.c b/caio/linux_uring.c |
| 14 |
index abd5200..008d882 100644 |
| 15 |
--- a/caio/linux_uring.c |
| 16 |
+++ b/caio/linux_uring.c |
| 17 |
@@ -682,8 +682,8 @@ static int AIOContext_init(AIOContext *self, PyObject *args, PyObject *kwds) { |
| 18 |
* |
| 19 |
* Opt-in (sqpoll=True): SQPOLL kernel thread polls SQ ring; io_uring_enter |
| 20 |
* only needed to wake a sleeping thread. Eliminates per-op syscall |
| 21 |
- * overhead at sustained high QD. EPERM on pre-5.11 kernels without |
| 22 |
- * CAP_SYS_NICE is treated like EINVAL (try next entry). |
| 23 |
+ * overhead at sustained high QD. Permission errors are treated like |
| 24 |
+ * EINVAL (try next entry), allowing fallback to a plain ring. |
| 25 |
* |
| 26 |
* IORING_SETUP_SINGLE_ISSUER deliberately never tried: it pins the ring |
| 27 |
* to whichever thread's io_uring_setup()/io_uring_enter() call created |
| 28 |
@@ -719,7 +719,7 @@ static int AIOContext_init(AIOContext *self, PyObject *args, PyObject *kwds) { |
| 29 |
flags_used = params.flags; |
| 30 |
break; |
| 31 |
} |
| 32 |
- if (errno != EINVAL && errno != EPERM) { |
| 33 |
+ if (errno != EINVAL && errno != EPERM && errno != EACCES) { |
| 34 |
PyErr_SetFromErrno(PyExc_SystemError); |
| 35 |
return -1; |
| 36 |
} |
| 37 |
-- |
| 38 |
2.55.0 |
| 39 |
|