On Wed, 2022-02-16 at 20:14 +0800, Hao Xu wrote: > > @@ -5583,6 +5650,7 @@ static void io_poll_task_func(struct io_kiocb > *req, bool *locked) > struct io_ring_ctx *ctx = req->ctx; > int ret; > > + io_add_napi(req->file, req->ctx); > ret = io_poll_check_events(req); > if (ret > 0) > return; > @@ -5608,6 +5676,7 @@ static void io_apoll_task_func(struct io_kiocb > *req, bool *locked) > struct io_ring_ctx *ctx = req->ctx; > int ret; > > + io_add_napi(req->file, req->ctx); > ret = io_poll_check_events(req); > if (ret > 0) > return; > I have a doubt about these call sites for adding the napi_id into the list. AFAIK, these are the functions called when the desired events are ready therefore, it is too late for polling the device. OTOH, my choice of doing it from io_file_get_normal() was perhaps a poor choice too because it is premature. Possibly the best location might be __io_arm_poll_handler()...