axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.72k stars 393 forks source link

`SQPOLL` can't be used in conjunction with `COOP_TASKRUN` #1075

Open ZhenbangYou opened 5 months ago

ZhenbangYou commented 5 months ago

I found when I used both flags in io_uring_queue_init, it would fail. However, I didn't find related info in the man page of either io_uring_queue_init or io_uring_setup. Is this an undocumented restriction?

ZhenbangYou commented 5 months ago

My environment:

  1. Kernel version: 6.1.21.2-microsoft-standard-WSL2+
  2. liburing version: 2.6, latest commit
ZhenbangYou commented 5 months ago

Also, SQPOLL, SINGLE_ISSUER, and DEFER_TASKRUN can't beused together, but the latter two can be used together. There's also no documentations about this.

DylanZA commented 5 months ago

SQPOLL doesnt make sense with DEFER_TASKRUN/COOP_TASKRUN or SINGLE_ISSUER as the issuer ends up being the kernel poll thread.

you are correct that there seems to be no documentation though :)

ZhenbangYou commented 4 months ago

Thanks! These restrictions make sense to me. I think the current man page about SINGLE_ISSUER is a little confusing:

Note that when IORING_SETUP_SQPOLL is set it is considered that the polling task is doing all submissions on behalf of the userspace and so it always complies with the rule disregarding how many userspace tasks do io_uring_enter(2).

It says SQPOLL complies with SINGLE_ISSUER, but doesn't say if they are allowed to be used together (in reality they are). When I was trying these flags, I thought "now that SINGLE_ISSUER is allowed with SQPOLL, why not try DEFER_TASKRUN so that it may improve my performance". Also, COOP_TASKRUN can be used without SINGLE_ISSUER no matter SQPOLL is set or not, which also led to my confusion when they three couldn't be used together.