On 9/2/21 12:04 PM, Pavel Begunkov wrote: > On 9/2/21 6:56 PM, Jens Axboe wrote: >> If a task exits normally, then the teardown of async workers happens >> quickly. But if it simply closes the ring fd, then the async teardown >> ends up waiting for workers to timeout if they are sleeping, which can >> then take up to 5 seconds (by default). This isn't a big issue as this >> happens off the workqueue path, but let's be nicer and ensure that we >> exit as quick as possible. > > ring = io_uring_init(); > ... > io_uring_close(&ring); // triggers io_ring_ctx_wait_and_kill() > rint2 = io_uring_init(); > ... > > It looks IO_WQ_BIT_EXIT there will be troublesome. I wonder if we can get by with just a wakeup. Let me test... -- Jens Axboe