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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 CF2B3C433E0 for ; Wed, 10 Feb 2021 23:18:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A29AD64DA8 for ; Wed, 10 Feb 2021 23:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233915AbhBJXSe (ORCPT ); Wed, 10 Feb 2021 18:18:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234038AbhBJXQE (ORCPT ); Wed, 10 Feb 2021 18:16:04 -0500 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7643FC0613D6 for ; Wed, 10 Feb 2021 15:15:21 -0800 (PST) Received: by mail-qk1-x735.google.com with SMTP id v206so3559111qkb.3 for ; Wed, 10 Feb 2021 15:15:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=A04FuOuabEMWMqveDhzS7fg2WzWndmfaSzVZorZ+JI4=; b=Ns6JsN5qtazoElgRVa0XnesDAewJX8RsV7itNxt5qvvBLLHy/UriQTck5x0LZ9beto KKJ5qWgZml/d78AylTy0WklTEY6iXsvfzstAuvjTjSC1CvQcq2apajyQRHHIMIvKcThx QT8LYwYOUm0Q6v33vq5gHvc5z+WyzANkliH+ZX5NnlQMHmz5xklxZxj/GfKY6pzGn3vV DwlUoYralmok9ceHhE7tzViRJ/DgY/GA6UQLXKrLTTHl/AITMqXzQ3cFx3TNaBYg8wgd UCQA1zOj1JJduZAv+MI3LPB30Azslwcn0fNmd+n/a8t7sPvpFAA/6cjhZ6aQb4qHmWSw pVeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=A04FuOuabEMWMqveDhzS7fg2WzWndmfaSzVZorZ+JI4=; b=IQP/kQw9KAYKBjnYR+5uwWLXY7pFQFhax+e258z2h8juGHoCw2UYFz2y++1qw32L5A OZxs1+uWD0DjP1nsipiRfVBomMglfm/ddatWO3GFmPFxZTaEivXdYaFs4DpxUkXhpbZ2 tMIwAWrATlYhtys0Qj+HhBDk9CBe0k0EIv7S4Bh4mx1NUywPv2THQHQI2FLG6zSjAHD5 NfxvkTErZYEGGkRuI+eQOIwGRNsnAFuZECZM28knUZQLYL+n7CV0bcqGAqGvB0EtRpv9 fdtxcp1sBKPuQSF0M0TfaJUZbWOnW1KgWCNnDi8A+w1QPB7QZZxwuo4ioUlARINf8cQU w4Vw== X-Gm-Message-State: AOAM530W5NdblfUaY9awxgVDOwweSsFHvf1k77HoQwpzGuf6VM3Rt5I1 l8Y3lmALwdI8+S23/JQ8hpNFzA== X-Google-Smtp-Source: ABdhPJzLnS834YVlzUo+5rDNp+XKYxMN4n/BJsoIOChs0YKKyZain+hoQIvek3LZAAen3REy/aAD3A== X-Received: by 2002:a05:620a:38e:: with SMTP id q14mr5930060qkm.239.1612998920655; Wed, 10 Feb 2021 15:15:20 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id k4sm167813qth.40.2021.02.10.15.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 15:15:19 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1l9yhb-006HKg-5i; Wed, 10 Feb 2021 19:15:19 -0400 Date: Wed, 10 Feb 2021 19:15:19 -0400 From: Jason Gunthorpe To: Joao Martins Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Andrew Morton , Doug Ledford , John Hubbard , Matthew Wilcox Subject: Re: [PATCH v3 3/4] mm/gup: add a range variant of unpin_user_pages_dirty_lock() Message-ID: <20210210231519.GR4718@ziepe.ca> References: <20210205204127.29441-1-joao.m.martins@oracle.com> <20210205204127.29441-4-joao.m.martins@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210205204127.29441-4-joao.m.martins@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 05, 2021 at 08:41:26PM +0000, Joao Martins wrote: > Add a unpin_user_page_range_dirty_lock() API which takes a starting page > and how many consecutive pages we want to unpin and optionally dirty. > > To that end, define another iterator for_each_compound_range() > that operates in page ranges as opposed to page array. > > For users (like RDMA mr_dereg) where each sg represents a > contiguous set of pages, we're able to more efficiently unpin > pages without having to supply an array of pages much of what > happens today with unpin_user_pages(). > > Suggested-by: Jason Gunthorpe > Signed-off-by: Joao Martins > --- > include/linux/mm.h | 2 ++ > mm/gup.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 64 insertions(+) Reviewed-by: Jason Gunthorpe > +/** > + * unpin_user_page_range_dirty_lock() - release and optionally dirty > + * gup-pinned page range > + * > + * @page: the starting page of a range maybe marked dirty, and definitely released. > + * @npages: number of consecutive pages to release. > + * @make_dirty: whether to mark the pages dirty > + * > + * "gup-pinned page range" refers to a range of pages that has had one of the > + * get_user_pages() variants called on that page. Tidy this language though, this only works with the pin_user_pages variants because it hardwires FOLL_PIN Jason