On 9/7/20 2:56 AM, Xiaoguang Wang wrote: > 3. When it's appropriate to set ctx's IORING_SQ_NEED_WAKEUP flag? In > your current implementation, if a ctx is marked as SQT_IDLE, this ctx > will be set IORING_SQ_NEED_WAKEUP flag, but if other ctxes have work > to do, then io_sq_thread is still running and does not need to be > waken up, then a later wakeup form userspace is unnecessary. I think > it maybe appropriate to set IORING_SQ_NEED_WAKEUP when all ctxes have > no work to do, you can have a look at my attached codes:) That's a good point, any chance I can get you to submit a patch to fix that up? > 4. Is io_attach_sq_data really safe? sqd_list is a global list, but > its search key is a fd local to process, different processes may have > same fd, then this codes looks odd, seems that your design is to make > io_sq_thread shared inside process. It's really meant for thread sharing, or you could pass the fd and use it across a process too. See the incremental I just sent in a reply to Pavel. That said, I do think the per-cpu approach has merrit, and I also think it should be possible to layer it on top of the existing code in for-5.10/io_uring. So I'd strongly encourage you to try and do that, so you can get rid of using that private patch and just have it upstream instead. -- Jens Axboe