Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp364462ybl; Thu, 15 Aug 2019 19:15:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHPeYy3TKaAQfn3AfEitKeHZtIKzE0FH2MDpLHcLzF3Lg3BJV6talt/E9fFnsevsoLYalJ X-Received: by 2002:a17:90a:3646:: with SMTP id s64mr4996770pjb.44.1565921728978; Thu, 15 Aug 2019 19:15:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565921728; cv=none; d=google.com; s=arc-20160816; b=S1NcZih6L3X4QNZ1hGQE8jS6v/dpxOkusM3NeludU0zM2qeQw6aWUCGnY6OUu/+nLA rAvzleA1RuV9omWBIZDAb349oTvzTMuN7WXKXCMv+7zwOb+80owrNMb2EDUNWPitiZhx r23p4qWEmAr/Wf+L+Z+xZz826eb2iSC84MaXzai9FqT13dFGZopCnANUoyVwpmnb8xn1 jql1lhn4baigmSiEPk6cF9ocJjFNbstRxn3kQ1hjccYgCFda56/uW9ptKYns/S6ez/FR Lii8yWWHT4VRc5UEV+GnwuNlGDTkPv2o6EYzBb6obH0p0SPZDLlu5VcyVbtvh2EUKzKy 6exA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=iNYDYKVrRpRnEo7TyIFnzJma8HwHSIJJS6Onnonm3a4=; b=N+lnCN9ZCJG3l5eh2gXFgNqdK3ogXNY8VRU/y3gRvULC0xAXHCSZAO2ng+skM7T5IW BfaANuQv+sj5B1JWWIXQUoUwOuAJDLzI8zFmEWBzKnpAIcs+y/xMzQWkg33GQ3q+F8GP WtEOzxlBGqKSWn/33Tw8ivYsnNM/EtbNU7AR/vrJIOgH0m56+gkUyD3QVuyJeIwdbid6 ZKckweZtav4CPIr01B5CNHLQ1RLvVwr54mQyfxSmG/sWVJjL5vhbrf8yRSe24AdQCjhM 5QnSOvZJD8B0Q5Phkk/h9KuEqirbSEZI3sm4saA6gZCP5GvGSAte98lyL0nZ487C6Ewh IoPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="gRe/cawP"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ds20si2045692pjb.9.2019.08.15.19.15.13; Thu, 15 Aug 2019 19:15:28 -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=@nvidia.com header.s=n1 header.b="gRe/cawP"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726512AbfHPCOL (ORCPT + 99 others); Thu, 15 Aug 2019 22:14:11 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:15793 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbfHPCOK (ORCPT ); Thu, 15 Aug 2019 22:14:10 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 15 Aug 2019 19:14:12 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 15 Aug 2019 19:14:09 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 15 Aug 2019 19:14:09 -0700 Received: from [10.110.48.28] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 16 Aug 2019 02:14:08 +0000 Subject: Re: [RFC PATCH 2/2] mm/gup: introduce vaddr_pin_pages_remote() From: John Hubbard To: Ira Weiny , Jan Kara CC: Andrew Morton , Christoph Hellwig , Dan Williams , Dave Chinner , Jason Gunthorpe , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , LKML , , , References: <20190812234950.GA6455@iweiny-DESK2.sc.intel.com> <38d2ff2f-4a69-e8bd-8f7c-41f1dbd80fae@nvidia.com> <20190813210857.GB12695@iweiny-DESK2.sc.intel.com> <90e5cd11-fb34-6913-351b-a5cc6e24d85d@nvidia.com> <20190814234959.GA463@iweiny-DESK2.sc.intel.com> <2cbdf599-2226-99ae-b4d5-8909a0a1eadf@nvidia.com> <20190815132622.GG14313@quack2.suse.cz> <20190815133510.GA21302@quack2.suse.cz> <20190815173237.GA30924@iweiny-DESK2.sc.intel.com> X-Nvconfidentiality: public Message-ID: <58b75fa9-1272-b683-cb9f-722cc316bf8f@nvidia.com> Date: Thu, 15 Aug 2019 19:14:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1565921652; bh=iNYDYKVrRpRnEo7TyIFnzJma8HwHSIJJS6Onnonm3a4=; h=X-PGP-Universal:Subject:From:To:CC:References:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=gRe/cawPAvvKSdqcSXxV0BoA22Rm11wp20pEHyCpKtYaNY3NvTNMCgmALlhtzu63M RIN3ZKEK8vifpbjEEnzFOUyI3Yl6wn/IXsxA7v8zVZr/JTwcIZiqqXqnZVpR31FtxW LRjVeT7m2OURFkEMYaWljedPYFG11RUPR+Kj9YErvI8wkkj12ypFa9D6sllAiLfyfl 0Re0SVd3Yol0BqOOIfZwkoSUIa605h9OKR8HgGsdeLCjZCuQngc0TTm5JUNQeqGAFw K/rTsEjAfTKf2rtwDqQpM7AKASOcW56X99NJr0h5hYkPgG0MQNSnrxD6ZasNBIsLz4 lcQC4JwZDBA3w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/15/19 10:41 AM, John Hubbard wrote: > On 8/15/19 10:32 AM, Ira Weiny wrote: >> On Thu, Aug 15, 2019 at 03:35:10PM +0200, Jan Kara wrote: >>> On Thu 15-08-19 15:26:22, Jan Kara wrote: >>>> On Wed 14-08-19 20:01:07, John Hubbard wrote: >>>>> On 8/14/19 5:02 PM, John Hubbard wrote: ... >> Ok just to make this clear I threw up my current tree with your patches here: >> >> https://github.com/weiny2/linux-kernel/commits/mmotm-rdmafsdax-b0-v4 >> >> I'm talking about dropping the final patch: >> 05fd2d3afa6b rdma/umem_odp: Use vaddr_pin_pages_remote() in ODP >> >> The other 2 can stay. I split out the *_remote() call. We don't have a user >> but I'll keep it around for a bit. >> >> This tree is still WIP as I work through all the comments. So I've not changed >> names or variable types etc... Just wanted to settle this. >> > > Right. And now that ODP is not a user, I'll take a quick look through my other > call site conversions and see if I can find an easy one, to include here as > the first user of vaddr_pin_pages_remote(). I'll send it your way if that > works out. > OK, there was only process_vm_access.c, plus (sort of) Bharath's sgi-gru patch, maybe eventually [1]. But looking at process_vm_access.c, I think it is one of the patches that is no longer applicable, and I can just drop it entirely...I'd welcome a second opinion on that... So we might be all out of potential users for vaddr_pin_pages_remote()! For quick reference, it looks like this: diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c index 357aa7bef6c0..4d29d54ec93f 100644 --- a/mm/process_vm_access.c +++ b/mm/process_vm_access.c @@ -96,7 +96,7 @@ static int process_vm_rw_single_vec(unsigned long addr, flags |= FOLL_WRITE; while (!rc && nr_pages && iov_iter_count(iter)) { - int pages = min(nr_pages, max_pages_per_loop); + int pinned_pages = min(nr_pages, max_pages_per_loop); int locked = 1; size_t bytes; @@ -106,14 +106,15 @@ static int process_vm_rw_single_vec(unsigned long addr, * current/current->mm */ down_read(&mm->mmap_sem); - pages = get_user_pages_remote(task, mm, pa, pages, flags, - process_pages, NULL, &locked); + pinned_pages = get_user_pages_remote(task, mm, pa, pinned_pages, + flags, process_pages, NULL, + &locked); if (locked) up_read(&mm->mmap_sem); - if (pages <= 0) + if (pinned_pages <= 0) return -EFAULT; - bytes = pages * PAGE_SIZE - start_offset; + bytes = pinned_pages * PAGE_SIZE - start_offset; if (bytes > len) bytes = len; @@ -122,10 +123,9 @@ static int process_vm_rw_single_vec(unsigned long addr, vm_write); len -= bytes; start_offset = 0; - nr_pages -= pages; - pa += pages * PAGE_SIZE; - while (pages) - put_page(process_pages[--pages]); + nr_pages -= pinned_pages; + pa += pinned_pages * PAGE_SIZE; + put_user_pages(process_pages, pinned_pages); } return rc; [1] https://lore.kernel.org/r/1565379497-29266-2-git-send-email-linux.bhar@gmail.com thanks, -- John Hubbard NVIDIA