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 2A89DC433DB for ; Wed, 10 Feb 2021 23:20:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CF58B64EDC for ; Wed, 10 Feb 2021 23:20:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF58B64EDC 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 680EA6B0072; Wed, 10 Feb 2021 18:20:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 630986B0073; Wed, 10 Feb 2021 18:20:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F9C36B0074; Wed, 10 Feb 2021 18:20:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id 342506B0072 for ; Wed, 10 Feb 2021 18:20:13 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EEB888025BC1 for ; Wed, 10 Feb 2021 23:20:12 +0000 (UTC) X-FDA: 77803928664.19.gold76_070919127613 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id D06FB1ACC2C for ; Wed, 10 Feb 2021 23:20:12 +0000 (UTC) X-HE-Tag: gold76_070919127613 X-Filterd-Recvd-Size: 4142 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 10 Feb 2021 23:20:12 +0000 (UTC) Received: by mail-qt1-f178.google.com with SMTP id n28so2880200qtv.12 for ; Wed, 10 Feb 2021 15:20:12 -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=7sLTM6hfOssPDiik8aCiVdZ9zDHcXXsYyD4UKDqlbPE=; b=MvJckpZHn/hprnwuzbgoMqt9Fu1fnum4GtFukDoVf5z8xeSrmRDVMHxrS1NWrvkB6u cm4O6rHocrqJQtnSYqK/5cTfAUp8Yfl3ZOMKtFvE3bqXh0SqxzKG0cEiFunuHxH+lR6k YwPQHK7lm2ZA0lKttIzkjMUd6v1C6/quD0vv9skkYZH+kC2o5+IcGDq4oqhTKdFpmdQB q32V+h7SiWmTYj0wEy0bTUUrz9TXdKoRnqj9sgm5sIv3DcFt+woW6+a9eQStIBdBERpV Tobur2Vggiax9rAYxMChluwdRObnUy16BOwoLXsNrv0tdQRiRCMtfMfd0FMGicmc5Sru tIMQ== 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=7sLTM6hfOssPDiik8aCiVdZ9zDHcXXsYyD4UKDqlbPE=; b=kYcnMf1OZ6fzdRHJT11dtHUcq7xbwLsJNCPLBOXKNxOtLA1WHsgaDYeBIVGwWgAt94 r0J1T3Iskso8i6GxHY+nkDFJ/8ltvRAKfJGoMZo7/wAYRf5WPFmt3rBsvmeMi5W1J9nW 3eaToMRNNmiALsQR1tbVfyGW8tohu85D72dQ2x+8PE6+Dnthsnj2AHvd7WUW7Nrvk09q UQlcR4klm+7s4Pp1/MiDq4TT/Lym/fJ5tppaZ+IhkXEbVD/LpDQ9boIa6G0TBQfh9k+k c8I4Xs4A8UJ+XN4TCZ0Ix4nKM8RJ5F3Md5JYFjua+KrSL7R+By7GO99p+PquEl0IsQIX CcaA== X-Gm-Message-State: AOAM530MNl75YBR41AxnPOt52Ag1A8nIbnEvqyiOxULc2B9Yk5ooX8ri /bYlx3qquMfDFakoWOfwXgQEZQ== X-Google-Smtp-Source: ABdhPJz/cMnoiG75rTy3LcWjyI/DvIwspEAJBwg1BCxWGX5SKpKUQGZl9SrIgn0qGy4tOlyvthThrw== X-Received: by 2002:ac8:37d1:: with SMTP id e17mr5146178qtc.215.1612999211741; Wed, 10 Feb 2021 15:20:11 -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 d128sm744698qkb.44.2021.02.10.15.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 15:20:11 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1l9ymI-006HPT-GH; Wed, 10 Feb 2021 19:20:10 -0400 Date: Wed, 10 Feb 2021 19:20:10 -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 1/4] mm/gup: add compound page list iterator Message-ID: <20210210232010.GT4718@ziepe.ca> References: <20210205204127.29441-1-joao.m.martins@oracle.com> <20210205204127.29441-2-joao.m.martins@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210205204127.29441-2-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:24PM +0000, Joao Martins wrote: > Add an helper that iterates over head pages in a list of pages. It > essentially counts the tails until the next page to process has a > different head that the current. This is going to be used by > unpin_user_pages() family of functions, to batch the head page refcount > updates once for all passed consecutive tail pages. > > Suggested-by: Jason Gunthorpe > Signed-off-by: Joao Martins > Reviewed-by: John Hubbard > --- > mm/gup.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) Reviewed-by: Jason Gunthorpe This can be used for check_and_migrate_cma_pages() too (there is a series around to change this logic though, not sure if it is landed yet) Jason