From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BC04C433EF for ; Sun, 19 Sep 2021 15:24:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7286E610A3 for ; Sun, 19 Sep 2021 15:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231877AbhISP0L (ORCPT ); Sun, 19 Sep 2021 11:26:11 -0400 Received: from kanga.kvack.org ([205.233.56.17]:37213 "EHLO kanga.kvack.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbhISP0L (ORCPT ); Sun, 19 Sep 2021 11:26:11 -0400 X-Greylist: delayed 1679 seconds by postgrey-1.27 at vger.kernel.org; Sun, 19 Sep 2021 11:26:10 EDT Received: by kanga.kvack.org (Postfix, from userid 63042) id C0D346B0072; Sun, 19 Sep 2021 10:56:45 -0400 (EDT) Date: Sun, 19 Sep 2021 10:56:45 -0400 From: Benjamin LaHaise To: Hamza Mahfooz Cc: linux-kernel@vger.kernel.org, kernel test robot , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-aio@kvack.org Subject: Re: [PATCH v2] aio: convert active_reqs into a hashtable Message-ID: <20210919145645.GE16005@kvack.org> References: <20210919144146.19531-1-someguy@effective-light.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210919144146.19531-1-someguy@effective-light.com> User-Agent: Mutt/1.4.2.2i Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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."