Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp996877imu; Tue, 11 Dec 2018 10:53:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/UMqcql+lA5iWpbICEU5/fFSfoUfd8I8ncymOiif3aS2EzbgVDaa22WeZj37gCjhii+jiz/ X-Received: by 2002:a63:85c6:: with SMTP id u189mr14975612pgd.156.1544554407666; Tue, 11 Dec 2018 10:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544554407; cv=none; d=google.com; s=arc-20160816; b=A5r8bghdoWLIwSzrYEwb5IPc6kaOODaRPjIutOv0c58DT++VDW1d9rMG7kJG3zb+3a 1ZtcK9d88mMzlYQ6OI00NeKjtb6HMNv6CPuSVPxZRq59KTFV1vyEEc56OGl+MqDqxHsb uBnZYQTugLnEZAvvnBlutsdUU4yRJXHAeYbdYW1BB6c4lqY+3++Bs8cr28vp8fAdO5hi 6RfEz4a2SDnAPt1xfSFaUF+gXMjFgZcghY2vSVBceda62BVjuBrqslr1PFHwVEY+DYtM sC5pQA9/iEeYfmaeB3NxUqAOwmgtBC066ErT1UX9eCF4W1EeT2whfqGDXdAgpnL0HLTl sEPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=u1BmhFV3jFYCpG9ky256q4G6ZKdW4+xMfLqBXcaHRnw=; b=HHG2g/JXr83OV3wgnx6wRgN82XZ4BwXOBwUjhqflVT4FQN9BSMdPvUZ4aGTGXFzVxh a7xK/xrZy53VwkzhS4E3rmY1rKikxGld5GnJcdvzNd9Tej0ntbcg7jgth1g/w/SF7/Ka ZESkd8gg2IKjcM7b8k9Pfw71X1gFDkYBIH2byw8fzWBM5Z31frVx3mS5ELT3SRaH3gUZ 23kiyEVbuaGp4oH6ogBrctqwZayLuYw37dxnQLdYfgqfpM62oafH4wJ4wS0qBamtFGhU HnKWVFsT5UVUhdBuaPp9Jc5CxUWJMEV+IepR7F1BEuu+DbbncpBIygxlQJpIKbrO9NCD SEGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=JGYnQQQG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si12545509plr.96.2018.12.11.10.53.12; Tue, 11 Dec 2018 10:53:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=JGYnQQQG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726710AbeLKSwI (ORCPT + 99 others); Tue, 11 Dec 2018 13:52:08 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:53793 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726350AbeLKSwI (ORCPT ); Tue, 11 Dec 2018 13:52:08 -0500 Received: by mail-it1-f194.google.com with SMTP id g85so5191158ita.3 for ; Tue, 11 Dec 2018 10:52:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=u1BmhFV3jFYCpG9ky256q4G6ZKdW4+xMfLqBXcaHRnw=; b=JGYnQQQGazlSIGRZIyID6hDBIoQeXJBgvPhrBnJXAQ3ZslGXRS8va2j3GmK9NL7QOC GAnlT3QmoYZMI1AouEOi2fCx3hBDX2CHzuq3uFC1ieiQLMO3YtzeDX8uZod32uCFwpIM jbbQ5pPbPcq07yOEFHxxXQ5dmRhsrbNauLoOTq3nf7c/BA45HAP2L5vzT5f/KrN9goNi 4Efhly3eY68GcI5zsLOt61p2Nf9FzRHExmEMyFhp/kOeNDXewFyRdlM6xNAbJm1qg2lu MycEy/+VIuoe/PWu0mX+tI79f6bWiZRAyucBq9unHN65Z4uBzIuKT42D/V/pGBUmklv8 2wuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=u1BmhFV3jFYCpG9ky256q4G6ZKdW4+xMfLqBXcaHRnw=; b=EFL868DNRbj1KxNvNQtfRZEvIkVUFfaZShAgjtnRmjKAY6YXAbzx5BThlGo5xX6m+j 3gaQ5fdrYBJGFSoo5IyGP45LQocJ4OLTUcy3jQfo2j1F6N8bzVlGev8uSBh3++EE5KgS Xv9jLUG4Aygq4tAT3Y6LjcwTGsTFQMOMRzAcfNXVs2kAKLkncNXCRIws/7rZU5iP0yWR Ekz7ndwYmhcKaAl7BYQ9C5vtyQT4EhwXI79DGHSKFFkupBbToWQCEGdJyKZkszLWdXgY ZBtdpEtK4tyyk+Sfrk0sEkQ9jNGkST0zn3gzgp7vo4NiJpV5yNZGJ4mM9GGK3QGAXW6/ bsZw== X-Gm-Message-State: AA+aEWYtKRh5G/gBYLS7SvoEVuBF2YQ50tUVkrAlxkhwtXM56Xog67WP iAmFagaWyeDoUS5zUbgYchornA== X-Received: by 2002:a24:a3c7:: with SMTP id p190mr1995834ite.39.1544554327286; Tue, 11 Dec 2018 10:52:07 -0800 (PST) Received: from [192.168.1.56] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id m45sm1503376iti.10.2018.12.11.10.52.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 10:52:06 -0800 (PST) Subject: Re: [PATCH] aio: Convert ioctx_table to XArray To: Matthew Wilcox Cc: Jeff Moyer , Alexander Viro , Benjamin LaHaise , Andrew Morton , Kees Cook , linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dan Carpenter , kent.overstreet@gmail.com References: <20181128183531.5139-1-willy@infradead.org> <20181211175156.GF6830@bombadil.infradead.org> <0f77a532-0d88-78bc-b9cc-06bb203a0405@kernel.dk> <6b9a45c4-47a2-4c44-aa7e-6e5e90eff9df@kernel.dk> <20181211185105.GI6830@bombadil.infradead.org> From: Jens Axboe Message-ID: Date: Tue, 11 Dec 2018 11:52:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181211185105.GI6830@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/11/18 11:51 AM, Matthew Wilcox wrote: > On Tue, Dec 11, 2018 at 11:32:54AM -0700, Jens Axboe wrote: >> Don't see any regressions. But if we're fiddling with it anyway, can't >> we do something smarter? Make the fast path just index a table, and put >> all the big hammers in setup/destroy. We're spending a non-substantial >> amount of time doing lookups, that's really no different before and >> after the patch. > > Thanks for checking it out. > > I think the fast path does just index a table. Until you have more than > 64 pointers in the XArray, it's just xa->head->slots[i]. And then up > to 4096 pointers, it's xa->head->slots[i >> 6]->slots[i]. It has the > advantage that if you only have one kioctx (which is surely many programs > using AIO), it's just xa->head, so even better than a table lookup. > > It'll start to deteriorate after 4096 kioctxs, with one extra indirection > for every 6 bits, but by that point, we'd've been straining the memory > allocator to allocate a large table anyway. I agree, and nobody cares about 4k kioctxs, you're way into the weeds at that point anyway. So as the followup said, I think we're fine as-is for this particular case. -- Jens Axboe