Hard
Hand-rolled io_uring submission with IORING_SETUP_SQPOLL
A team writes its own io_uring ring code, without liburing. It sets up the ring with IORING_SETUP_SQPOLL and sq_thread_idle = 2000 ms. Since 'SQPOLL means zero syscalls', the submit path only fills an SQE and publishes the new SQ tail. It never calls io_uring_enter(). Under steady traffic everything works. After a 10-second quiet period overnight, the next requests are never completed, and nothing moves until the process is restarted. Why?
ring.cpp
void submit(Ring& r, const io_uring_sqe& sqe) {
unsigned tail = *r.sq_tail;
r.sqes[tail & *r.sq_mask] = sqe;
r.sq_array[tail & *r.sq_mask] = tail & *r.sq_mask;
__atomic_store_n(r.sq_tail, tail + 1, __ATOMIC_RELEASE);
// no io_uring_enter(): the SQPOLL kernel thread will pick it up
}53 of 53 in Operating Systems