On 6/4/20 9:38 PM, 陈云星 wrote: > io-uring instance can be set flag : IO_URING_SETUP_SQPOLL to enable > kernel thread polling SQ. but some application have random io > behavior, for example: > a). a burst read/write for a while, > b). then many scatter small io operations. > > during a) period, use sqpoll will be beneficial to performance. > but during b) period, use sqpoll will waste cpu time for empty busy poll. > > If we can have a method to tell kernel start/stop poll sq when we > need, it is good for both of a) and b): > in a) period, io_uring_enter tell kernel. start to poll > after a) , io_uring_enter tell kernel stop polling and. We already have the start side of it, that's io_uring_enter() which should be done when IORING_SQ_NEED_WAKEUP is set. I do like your suggestion of making it go to sleep on demand instead of always waiting for the grace period. We recently added IORING_CQ_EVENTFD_DISABLED, and we can use the same area for this as well. Eg add IORING_CQ_SQPOLL_SLEEP or something like that, and have the sq thread look for it. If set, it'll stop busy looping and go to sleep. -- Jens Axboe