Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp567041rwr; Wed, 19 Apr 2023 10:00:44 -0700 (PDT) X-Google-Smtp-Source: AKy350Z+gSUaijrYJ1r90W0YQ5anJlfvhWjwIN8JzGyL9VRfTUkRoWpWfsIweVgGuoe3FVgiQ75F X-Received: by 2002:a05:6a00:1709:b0:625:ebc3:b26c with SMTP id h9-20020a056a00170900b00625ebc3b26cmr5168835pfc.22.1681923644038; Wed, 19 Apr 2023 10:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681923644; cv=none; d=google.com; s=arc-20160816; b=QYKISihhFuub48443KAbqmNHVhItQH4UDTf/nB7oJlRQMUhehGo5uQ26iQE6vtFZ0J P3vgZp5hTyXx5/8kWFk4AU82lAbC2UVM5VR0pC++BSv1OPal8vdkJw2URwoSUGf8M84C PqHQl/E8GPcYPpHF3K8koIZXyhqqbcoEDZlOWRAc+NFlkK3O3H3KUrp0IxKCZ3Ebg3cE 6G3mQuV4NR4ZkbpmiREvByTFG8xc0Tg2VGK+6uTQ0ylmDW2sx6knzyyX+toAfHNMmglT vZqIkj0xZiYjCA//AoWnZiawecqV30KHK4inflpzHkzLwjBDQ/WqzebdmIR006uaack1 PZJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=GZA/Y2Xcvpydl47ecxb70c5FYkq2jeab6dGCHqHNDLM=; b=CAnnKnB7aMSohLIM9SvOvWkr+PDGZUKm0jew2UxVys9jmDchrfQ39cMJwFSQK3E+Ax 8EIpcba+OGE7KLZvwjZvgnywabSUjSDF50IQq88b7HS5GynyOlY+WMiWwq19x9TD4WZx Clv966NJ+0vrHnuL6sbXaZem3Bz0HhsKUijuqXLWVbIWdH6K5/gp4QxY9bpZcGbSqytm JpjGX6/CEj8lMhtFKNHcFifK/2BgswPgQMuBqTf+H/4Ygunb4S6pJ21AcqGfzgldbc2X 35ymzVe9zL6gDcISEr+HKxU8geuTulK0PNbyDeFN9ZGu6PVRAvIQV1IDwZeWJ8VKORgB c/Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b="XzJ1HS3/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l63-20020a638842000000b0051b5fc497e9si1916938pgd.739.2023.04.19.10.00.27; Wed, 19 Apr 2023 10:00:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b="XzJ1HS3/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbjDSQ7c (ORCPT + 99 others); Wed, 19 Apr 2023 12:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbjDSQ7a (ORCPT ); Wed, 19 Apr 2023 12:59:30 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6926F6A5B for ; Wed, 19 Apr 2023 09:59:29 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1a7111e0696so375745ad.1 for ; Wed, 19 Apr 2023 09:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20221208.gappssmtp.com; s=20221208; t=1681923569; x=1684515569; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=GZA/Y2Xcvpydl47ecxb70c5FYkq2jeab6dGCHqHNDLM=; b=XzJ1HS3/fHRLsOUi5jteCYlLIRtuVLu997uZN/qGqPd6zMDOa8KMT5WStPJuEf/gs0 Wpa4XHqd48KpIIcr4U5Q1ETw4ixS2x4TNAUBa5uVY/dWirkK9vkjEpk2CUyL7jpJ8cFf 0HxDu50X8eO7z2xnWVhyls5YoqwZVE3mEKSKA6Y5ZciI9xYo9VPGInsWwK6WfgXFBj3N xq2SPGIxhEKidNtEh/iKm/wSnFQ3wA08rI9A64MtAN0M1uIORdfkkml8Afr/YRt8W0Gl E7VuMGz1QJzcqy4O0jkeMge2wNTWvSZKBa9e7JomIbf0R2Q3T6pPbOlfCJSMYXDojjKU owRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681923569; x=1684515569; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GZA/Y2Xcvpydl47ecxb70c5FYkq2jeab6dGCHqHNDLM=; b=WSZKaDIFdZLp9CUjG68evxzv48l6SIAFWRBZ6rlRvKWiGFt4v0iLMcgbjTVsBmllDc Z1Z+1Ub3jSvdoxcUjEnEZ7UJcD/ooquBhA73q9tFM55DM7zNQ6aooF0m5QW6DddIjD8c 7HVP/Q48d+7TgcgalEVhfpehEbaK7J7Dxiajtv7kV4GIZhe2h2vKoWIJ0KqYc7OBYU6o IjpBXBIbCXnInSAVA/mVd5nzpovxc4F2UJUgzjfwiIC8qZ4uXmINIV/yGBMQxV+DChwq W/ek0S0L6jygUtpG+grh4Kun5HyeHU4ufg9vmTZBVMXIYd5UpBJsEWkHiRhNU2frh9gM fsWQ== X-Gm-Message-State: AAQBX9eQnMYK51Xiu7zgPXG1AFNAXa7mbdis+3LgMLbH89OXk7QSnYIf O97FmWvl4y14kn0pDnKv4p5l4w== X-Received: by 2002:a17:903:11c9:b0:1a6:6bdb:b548 with SMTP id q9-20020a17090311c900b001a66bdbb548mr22281935plh.1.1681923568889; Wed, 19 Apr 2023 09:59:28 -0700 (PDT) Received: from [192.168.1.136] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id g7-20020a170902740700b001a0448731c2sm11655079pll.47.2023.04.19.09.59.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Apr 2023 09:59:28 -0700 (PDT) Message-ID: Date: Wed, 19 Apr 2023 10:59:27 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v4 4/6] io_uring: rsrc: avoid use of vmas parameter in pin_user_pages() Content-Language: en-US From: Jens Axboe To: Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Cc: Matthew Wilcox , David Hildenbrand , Pavel Begunkov , io-uring@vger.kernel.org References: <956f4fc2204f23e4c00e9602ded80cb4e7b5df9b.1681831798.git.lstoakes@gmail.com> <936e8f52-00be-6721-cb3e-42338f2ecc2f@kernel.dk> In-Reply-To: <936e8f52-00be-6721-cb3e-42338f2ecc2f@kernel.dk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/19/23 10:35?AM, Jens Axboe wrote: > On 4/18/23 9:49?AM, Lorenzo Stoakes wrote: >> We are shortly to remove pin_user_pages(), and instead perform the required >> VMA checks ourselves. In most cases there will be a single VMA so this >> should caues no undue impact on an already slow path. >> >> Doing this eliminates the one instance of vmas being used by >> pin_user_pages(). > > First up, please don't just send single patches from a series. It's > really annoying when you are trying to get the full picture. Just CC the > whole series, so reviews don't have to look it up separately. > > So when you're doing a respin for what I'll mention below and the issue > that David found, please don't just show us patch 4+5 of the series. I'll reply here too rather than keep some of this conversaion out-of-band. I don't necessarily think that making io buffer registration dumber and less efficient by needing a separate vma lookup after the fact is a huge deal, as I would imagine most workloads register buffers at setup time and then don't change them. But if people do switch sets at runtime, it's not necessarily a slow path. That said, I suspect the other bits that we do in here, like the GUP, is going to dominate the overhead anyway. My main question is, why don't we just have a __pin_user_pages or something helper that still takes the vmas argument, and drop it from pin_user_pages() only? That'd still allow the cleanup of the other users that don't care about the vma at all, while retaining the bundled functionality for the case/cases that do? That would avoid needing explicit vma iteration in io_uring. -- Jens Axboe