Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2160523ybm; Thu, 23 May 2019 12:20:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTL5CCJQJ8945UXPdvgBeYyn/CYrC2/VCrzNSXRLOEt9fZ/GzVxhSxcRwEXgSNedvpjoou X-Received: by 2002:a62:198e:: with SMTP id 136mr87515974pfz.180.1558639255250; Thu, 23 May 2019 12:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558639255; cv=none; d=google.com; s=arc-20160816; b=wU6c3C5d7XLqhNHcEuyP4/CNpHZcfvM1/sajM8PQLkT2hR5szIic64KAPzR/FPRtyX A+wRXZNVF4VaujOFxKVFy2MJsilHuBqB8BgImgy4W+gNpwz9XYVAVwQzy07vQxHn8Qhq y1m2YVxzC2ea4Oof4hovb4RSmOyOFNNoIoubhofEaJqAVDm7NGC7GxaPdn55x/xXvFhW ZYaXGM0DzxgqjyWy3n8FyUKAY0wuC67XiWSR+q/8AAh0zzuU0U97iNPPbU/feFIKYVDA ywwsEU58BcuR38+v4l7CMFMWl6Kzf8zgRJ/QqTBQaSyWSsCL0k3K3j0v6mAqAG5mSFNg pXiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Pm+Vx0dhObnzybiaJozRDpH0LoNYUiVOhc6EGMjBZwU=; b=ZbWvQMDikVnAwkczE67YHV8h0YYxfU4TOLz8buy46DelxuGERBJenJJJre60CzQzUp KpI+QYdA76za4sX2qaD49dfOESiiZotHR45SdtQg5knZ91iTc04PQx7BRCLK0j+RUCeJ VnmYMbMYqWZqXGuHsdpeA5KQ53B2oOazGRGN8INrGOIA+wn3+V8WaKTCFmxPd2Cq1a5H KwE3BheYQMQ+Yz2Na47sbaTW7/U23n5yVUMSXNLCj7JzexI/EkSgcjmXoUpTd+//79or D3ZL3nOaDyKIdi5lOeQAHD32cBE5Ow1qOEyBahWqbbxuIamNx9Ce0HihohpHVj4MOGCa DDBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=O0RCPEGv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si548078plq.116.2019.05.23.12.20.39; Thu, 23 May 2019 12:20:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=O0RCPEGv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389475AbfEWTRz (ORCPT + 99 others); Thu, 23 May 2019 15:17:55 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:37836 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389454AbfEWTRg (ORCPT ); Thu, 23 May 2019 15:17:36 -0400 Received: by mail-qt1-f193.google.com with SMTP id o7so8117338qtp.4 for ; Thu, 23 May 2019 12:17:36 -0700 (PDT) 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:user-agent; bh=Pm+Vx0dhObnzybiaJozRDpH0LoNYUiVOhc6EGMjBZwU=; b=O0RCPEGvWXVRXRZ7y88skUaFHv3isN4h6Tr6VLsss0em/c8A1IncniPr014w2Ci4io 9rBOKNHmm68kYI6ygpwlm+QtR16oXFPy2bhxS9CwKHFqrIfMtEWctvqEZ4eVLH4Cn7TJ HOeZtmCGjBcvBSU18syidFL3Um1gGyCpWXeJsZC2Nvpz7PwdjRmaH9U2HY3sw2gtM83U WGdsqtqNuVbxSdeTfdP4MztNl8z1hsbkujcQdJiIBLEMbySogRMR8przLBmtfBbirVh8 fc9baIPJgppq8UkcxW/nJPwGb+5dwFFa4fUBYQGfezP1UVVzSkaq/4vRP8kXOph9tKhv tF2w== 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:user-agent; bh=Pm+Vx0dhObnzybiaJozRDpH0LoNYUiVOhc6EGMjBZwU=; b=f0xMvVWbbw3D0Numv2fp5vVEQhJBphO8cf8/2qwwGU82un4BgaRgwnmK3N1qzf45vn cgYg0VKq+f8mPBvsNzRHaaum91hRMCUnG8bnzhMMIDhzaRwMNAmoC8iOKk1zEveZrvKh 7rtrtpxXak1hW1vymLZRdkB8Fb4xa1IzO5f4b072Im0+3mh1CCHENgF6pABcT23kX61I 8Rl3bPLUFWPwy6WWxWjAldN9TgEGU9KyfWH9KKGdbL/iiAnWl+4At2gQ9vkzw2uIAgmJ tZVU958Il3UAYXBdeXZil8wdS9KQqBAWu4G4FYrFlNgV/Nmi/TXYoo7xmuC+a84rJCHd 4HgQ== X-Gm-Message-State: APjAAAWltBe9r7QvoUn9SWPq/MNd1p88DMQDj/7fzPYMfybaNszV3trN PjLSZzHh3BK4PAIUcqCmjGFrag== X-Received: by 2002:a0c:9acb:: with SMTP id k11mr59015856qvf.85.1558639055850; Thu, 23 May 2019 12:17:35 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id q24sm139016qtq.58.2019.05.23.12.17.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 May 2019 12:17:35 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hTtDa-0000kS-RM; Thu, 23 May 2019 16:17:34 -0300 Date: Thu, 23 May 2019 16:17:34 -0300 From: Jason Gunthorpe To: John Hubbard Cc: Ira Weiny , "john.hubbard@gmail.com" , Andrew Morton , "linux-mm@kvack.org" , LKML , "linux-rdma@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , Doug Ledford , Mike Marciniszyn , Dennis Dalessandro , Christian Benvenuti , Jan Kara Subject: Re: [PATCH 1/1] infiniband/mm: convert put_page() to put_user_page*() Message-ID: <20190523191734.GH12159@ziepe.ca> References: <20190523072537.31940-1-jhubbard@nvidia.com> <20190523072537.31940-2-jhubbard@nvidia.com> <20190523172852.GA27175@iweiny-DESK2.sc.intel.com> <20190523173222.GH12145@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 23, 2019 at 10:46:38AM -0700, John Hubbard wrote: > On 5/23/19 10:32 AM, Jason Gunthorpe wrote: > > On Thu, May 23, 2019 at 10:28:52AM -0700, Ira Weiny wrote: > > > > @@ -686,8 +686,8 @@ int ib_umem_odp_map_dma_pages(struct ib_umem_odp *umem_odp, u64 user_virt, > > > > * ib_umem_odp_map_dma_single_page(). > > > > */ > > > > if (npages - (j + 1) > 0) > > > > - release_pages(&local_page_list[j+1], > > > > - npages - (j + 1)); > > > > + put_user_pages(&local_page_list[j+1], > > > > + npages - (j + 1)); > > > > > > I don't know if we discussed this before but it looks like the use of > > > release_pages() was not entirely correct (or at least not necessary) here. So > > > I think this is ok. > > > > Oh? John switched it from a put_pages loop to release_pages() here: > > > > commit 75a3e6a3c129cddcc683538d8702c6ef998ec589 > > Author: John Hubbard > > Date: Mon Mar 4 11:46:45 2019 -0800 > > > > RDMA/umem: minor bug fix in error handling path > > 1. Bug fix: fix an off by one error in the code that cleans up if it fails > > to dma-map a page, after having done a get_user_pages_remote() on a > > range of pages. > > 2. Refinement: for that same cleanup code, release_pages() is better than > > put_page() in a loop. > > > > And now we are going to back something called put_pages() that > > implements the same for loop the above removed? > > > > Seems like we are going in circles?? John? > > > > put_user_pages() is meant to be a drop-in replacement for release_pages(), > so I made the above change as an interim step in moving the callsite from > a loop, to a single call. > > And at some point, it may be possible to find a way to optimize put_user_pages() > in a similar way to the batching that release_pages() does, that was part > of the plan for this. > > But I do see what you mean: in the interim, maybe put_user_pages() should > just be calling release_pages(), how does that change sound? It would have made it more consistent.. But it seems this isn't a functional problem in this patch Jason