Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5617908rwe; Tue, 18 Apr 2023 09:06:48 -0700 (PDT) X-Google-Smtp-Source: AKy350ZE9kHpHy1S4gsQpkUjDmOWkSzpXALtpD/c7fPYdPvGRbWG0643xCLghs7D1rEuxSyirSNu X-Received: by 2002:a17:90b:4a0d:b0:246:d13c:c027 with SMTP id kk13-20020a17090b4a0d00b00246d13cc027mr71761pjb.24.1681834008405; Tue, 18 Apr 2023 09:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681834008; cv=none; d=google.com; s=arc-20160816; b=iZcodFPlCOIWnky3z5lYhT4578Yc2A0NlEmgBUGJsGEQP4jrk99291tGpjMkR3BycS j09TPHd2Pm71jdgtFXeM+yHmR0mg7p5q33BluTnBBjptoKHGd26l3BDOOqAU4Uh9w7Q5 JTBmm4olRIpD2DIODscV8evUXvwiPz60kwTXe41cU7KCepz+WHedp0xO9V2Re7StItV/ CAkOhnFSyz1ZXmp6es1j+6Dr9YzdazjHYFHDma6MoIZw/uWa0JUUiZnXq2PUe8lurIWa nvKa+QKUvIvDxmqfJplhrk695f/ELjRPKW3E0YERJl/QGBIb5TAPiUm9QQKNDPa9ed/R Plcg== 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 :organization:references:cc:to:from:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=Juss3UIfNZnJDgajqfUY7HSWywG2tSbHHgh51Zf9/Ao=; b=u3BTlFJFzN7LCsE5nov93b8tkYcPekFuE4ugFvBawvr3dCvIyr8bnX7XXcPCznKiUe wWXAYqdE1pyskcMXAscbJa//hD7nfQxBjqhW0z1kaMjnT6+qcgx4rTmS1imawyE4NfRC Md2HTpe2M9LaupLz9ukzfmgJ1+iZnbXj3l1k7eE097M4ecZfssRDTzVQMr42LtN4fBj5 PR8t6EGBUnz8p/6Vn3RXj7keL+Hq4GoHGzydpps6J712wAfzHHca2a/9sIiSy+stYEvH A0RWBpfph9Y4wzDVbN3dMQIHO3l4MVviKrxPFAb8ltrJy7rSpywPvEVqPYDoizZly1/X +EfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JCk1pFo0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g9-20020a17090a714900b00246b7a596eesi16764072pjs.146.2023.04.18.09.06.21; Tue, 18 Apr 2023 09:06:47 -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=@redhat.com header.s=mimecast20190719 header.b=JCk1pFo0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232471AbjDRP5b (ORCPT + 99 others); Tue, 18 Apr 2023 11:57:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232459AbjDRP50 (ORCPT ); Tue, 18 Apr 2023 11:57:26 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A00072B8 for ; Tue, 18 Apr 2023 08:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681833404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Juss3UIfNZnJDgajqfUY7HSWywG2tSbHHgh51Zf9/Ao=; b=JCk1pFo0nM/aWrQNqZjorNM7I4gaDyt9wToIOTO08qVOjl37WEClsZTauTycIYcSOdTup/ YBoTS47l4SJ2jhUnWAllwSpOjoM315S3Y8euUKhgtJ2uSVy2TsN2Lyc87Wvh5q+ZpR4MJW 8ukyptJNLeNSoDjaHgBJWTKU+D9tiJA= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-187-chj_1D7rNHexbvAm_1s2Yw-1; Tue, 18 Apr 2023 11:56:43 -0400 X-MC-Unique: chj_1D7rNHexbvAm_1s2Yw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f0b0c85c4fso42618885e9.0 for ; Tue, 18 Apr 2023 08:56:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681833402; x=1684425402; h=content-transfer-encoding:in-reply-to:organization: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=Juss3UIfNZnJDgajqfUY7HSWywG2tSbHHgh51Zf9/Ao=; b=Z/csfzO8md+8hIdiqvXuXXNUcRUK8rE5UIW7w6MKyqKaexOfPmVrxmbcMdYGsgH3sB dO6vPL4BVKhvN79s3cepC0/pXBbTumMosuKc56XaHNsbxJ1zb+v1Q4LccgGGIeZiXXGY rfIW3kOQMm6Ho2e1LlWpHh7UPaS1IFFSkL9rYmD3d5zcW0eCqlpAjwCi5Cdw9rHKpHoK AkGKfCsWddFJbQwJ/oYLeCg3a7BiVxMw43JPVjVEwg5WiI84sgMyE/n6SFYBEX+jrSi/ YJq3uGscF1IuxTevE92HkZFZLRKPeopRr+vdYBRlNz1AEvGcirfNZv4due+YtytgD6a2 VW+g== X-Gm-Message-State: AAQBX9cAdpQfQhoDU9bM4ZbW4sn2+I7DszkENUE0TWzR9Z9Lt5I6WBOU UPaCn1hl70+SeCM7q/aptwHUNBPAvg0RQoVp7ZmiTMLRp5HP3uP8TfyeNivxpVw87MDsTnduqSg 6hcJcJwcHLRfUnpdsb5VrzUgScdtbaLi/ X-Received: by 2002:a5d:6781:0:b0:2fc:3596:7392 with SMTP id v1-20020a5d6781000000b002fc35967392mr2628935wru.24.1681833402338; Tue, 18 Apr 2023 08:56:42 -0700 (PDT) X-Received: by 2002:a5d:6781:0:b0:2fc:3596:7392 with SMTP id v1-20020a5d6781000000b002fc35967392mr2628920wru.24.1681833402021; Tue, 18 Apr 2023 08:56:42 -0700 (PDT) Received: from ?IPV6:2003:cb:c715:3f00:7545:deb6:f2f4:27ef? (p200300cbc7153f007545deb6f2f427ef.dip0.t-ipconnect.de. [2003:cb:c715:3f00:7545:deb6:f2f4:27ef]) by smtp.gmail.com with ESMTPSA id z2-20020adff1c2000000b002f900cfc262sm8099302wro.66.2023.04.18.08.56.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Apr 2023 08:56:41 -0700 (PDT) Message-ID: <21bc9c1e-9941-9f51-0a38-85ae406ff2cd@redhat.com> Date: Tue, 18 Apr 2023 17:56:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v4 4/6] io_uring: rsrc: avoid use of vmas parameter in pin_user_pages() Content-Language: en-US From: David Hildenbrand To: Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Cc: Matthew Wilcox , Jens Axboe , Pavel Begunkov , io-uring@vger.kernel.org References: <956f4fc2204f23e4c00e9602ded80cb4e7b5df9b.1681831798.git.lstoakes@gmail.com> <7fabe6ee-ba8f-6c48-c9f7-90982e2e258c@redhat.com> Organization: Red Hat In-Reply-To: <7fabe6ee-ba8f-6c48-c9f7-90982e2e258c@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, 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 18.04.23 17:55, David Hildenbrand wrote: > On 18.04.23 17:49, 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(). >> >> Suggested-by: Matthew Wilcox (Oracle) >> Signed-off-by: Lorenzo Stoakes >> --- >> io_uring/rsrc.c | 55 ++++++++++++++++++++++++++++--------------------- >> 1 file changed, 31 insertions(+), 24 deletions(-) >> >> diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c >> index 7a43aed8e395..3a927df9d913 100644 >> --- a/io_uring/rsrc.c >> +++ b/io_uring/rsrc.c >> @@ -1138,12 +1138,37 @@ static int io_buffer_account_pin(struct io_ring_ctx *ctx, struct page **pages, >> return ret; >> } >> >> +static int check_vmas_locked(unsigned long addr, unsigned long len) > > TBH, the whole "_locked" suffix is a bit confusing. > > I was wondering why you'd want to check whether the VMAs are locked ... FWIW, "check_vmas_compatible_locked" might be better. But the "_locked" is still annoying. -- Thanks, David / dhildenb