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=ham 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 68DF5C433DB for ; Wed, 10 Feb 2021 23:15:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E375C64E6B for ; Wed, 10 Feb 2021 23:15:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E375C64E6B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 72A126B0005; Wed, 10 Feb 2021 18:15:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DABF6B0006; Wed, 10 Feb 2021 18:15:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C99A6B006C; Wed, 10 Feb 2021 18:15:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 486A16B0005 for ; Wed, 10 Feb 2021 18:15:22 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0CD3B8248068 for ; Wed, 10 Feb 2021 23:15:22 +0000 (UTC) X-FDA: 77803916484.22.gun23_160fc3427613 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id D57E118038E71 for ; Wed, 10 Feb 2021 23:15:21 +0000 (UTC) X-HE-Tag: gun23_160fc3427613 X-Filterd-Recvd-Size: 4784 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Wed, 10 Feb 2021 23:15:21 +0000 (UTC) Received: by mail-qk1-f181.google.com with SMTP id o193so3533406qke.11 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=DDK21+mdrxyhKK3vLtUYusKHZEPdyvWBuYZe1FyNbk1vlY4GbSkSEBFiS23oxq9yGn 5gK+vrI4AlYTbw75ibTgXl+maBfQAuSwBRdbQMwYvpTsg8mR5g92gbeyFrVzgKB0DP/N uQLOJQzsTMtCfITO4dbm7uZzsMh30MwChs4+s+CEQ4YhnrizvBuuTYSBknjw9kwsHsu5 PVo7i0MSkzQiAnOk2FfqEZicd1CbYe5usWixRQxkxBhpVugZ+ceNDvfGf+4mRdwhpiyM 6/LfwY10LARnwC5MwlbqwbJJlKpEqKfgbfPv7MRzYEC4h6VBpoNRXcijwS/qmeMEKTAX vWkw== X-Gm-Message-State: AOAM5338timPn9j3ZqvMMo4lj6Kwx7x6rzqeSg/PyCsT/69z+nyzPpfE NWZQ8PYOpB+cg9FZw62zoDCYug== 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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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