2021-09-19 17:37:36

by Benjamin LaHaise

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

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."


2021-09-23 13:04:03

by Hamza Mahfooz

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



On Sun, Sep 19 2021 at 10:56:45 AM -0400, Benjamin LaHaise
<[email protected]> wrote:
> 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.

Would that not mean that, we would have to keep track of the indices of
the
array that are not being held by an `aio_kiocb`?


2021-09-23 16:57:48

by Benjamin LaHaise

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

On Thu, Sep 23, 2021 at 09:00:43AM -0400, Hamza Mahfooz wrote:
> Would that not mean that, we would have to keep track of the indices of
> the
> array that are not being held by an `aio_kiocb`?

Correct. This is a better solution than the hash table and would mean
that the requests list could likely be replaced by the table.

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