Re: [PATCH v2] aio: convert active_reqs into a hashtable

From: Benjamin LaHaise
Date: Sun Sep 19 2021 - 11:24:54 EST


On Sun, Sep 19, 2021 at 10:41:46AM -0400, Hamza Mahfooz wrote:
> Commit 833f4154ed56 ("aio: fold lookup_kiocb() into its sole caller")
> suggests that, the fact that active_reqs is a linked-list means aio_kiocb
> lookups in io_cancel() are inefficient. So, to get faster lookups (on
> average) while maintaining similar insertion and deletion characteristics,
> turn active_reqs into a hashtable.

You're doing this wrong. If you want faster cancellations, stash an index
into iocb->aio_key to index into an array with all requests rather than
using a hash table.

-ben
--
"Thought is the essence of where you are now."