Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2486480ybc; Wed, 13 Nov 2019 15:26:42 -0800 (PST) X-Google-Smtp-Source: APXvYqzgSAJbKOoLfWIrAorbpioGC/WkKH8S4kwqND+7Qjoca0RE6L8ZmPHY3ExXYJ0E5yQUkQMC X-Received: by 2002:a50:fb8d:: with SMTP id e13mr6485452edq.213.1573687602685; Wed, 13 Nov 2019 15:26:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573687602; cv=none; d=google.com; s=arc-20160816; b=IwfymtsTRsaVGdp2fi1SX7Fz5aw4WYxVr/I4m8+yQysGWARa08NgJ7GNuLsd68uqgB xPEsXcUJwDD/MSDiJUn2cRKBlblinB2sQxgKoilPLFL+vNYRFtc1cJtJBX1GEkP58lOY 0dcCayBsUkSX8899RM+HDVanp7c1ufHh2Q9OQeeIKSTimsuLSX5dJmH1rca2F7BNeePO QmrgNhCVz4n+SRFc7jmjVnwcV95SQoXe23uPgwKpSeOGjR5Ys7rTbhVVh1QIEXKciNpn Dq6pKdfFHwO07dXQEMNh6yylJDUDVe8ll8p7jFEj2d4IetVZyAfckofPAiyGUGOdlA7i ZlxA== 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:from:references:cc:to:subject; bh=1TmaF+0LQcsFxIIl+yPUdlXgPu3Pw2KrYq1UfrZmOD8=; b=GKwyXyIRbZuxt6PeptI/jLyfAL2wUGGowU+uzHHKURIvTCQciRRqduFGW+5NwLn7oq xVKBUYKiX04LqZNsrC1fxXv4YB5ndRgs1P8pZMKgtOAKrx1FEBzZTbkMFAaCW1H/8XZl eolfVzp1IqlxLBSUIySD1fAZERaUyiMjlCR2jpt2CHk28JYcDa5eHP9Rshu/d+pfGRWq JhAmppMSumkAPEMelqGqflOzHE5oWU7topzCrPcMzLuQthRUc9I8gvnTLYkcECa1K3+0 yle9Qv1WfW2dVY2RuT1HLLiWSlJKgBCMjb6kDuQ2+dgbe1I7IOr5Dn6cKVdpPk1M4w08 tNTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Sgh8xQ9P; 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 u59si2914085edc.193.2019.11.13.15.26.08; Wed, 13 Nov 2019 15:26:42 -0800 (PST) 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=Sgh8xQ9P; 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 S1727036AbfKMXZ1 (ORCPT + 99 others); Wed, 13 Nov 2019 18:25:27 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:2241 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726303AbfKMXZ0 (ORCPT ); Wed, 13 Nov 2019 18:25:26 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 13 Nov 2019 15:24:24 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 13 Nov 2019 15:25:20 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 13 Nov 2019 15:25:20 -0800 Received: from [10.2.160.107] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 13 Nov 2019 23:25:19 +0000 Subject: Re: [PATCH v4 09/23] mm/gup: introduce pin_user_pages*() and FOLL_PIN To: Jan Kara CC: Andrew Morton , Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Christoph Hellwig , Dan Williams , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Ira Weiny , Jason Gunthorpe , Jens Axboe , Jonathan Corbet , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman , Michal Hocko , Mike Kravetz , Paul Mackerras , Shuah Khan , Vlastimil Babka , , , , , , , , , , , , , LKML , Mike Rapoport References: <20191113042710.3997854-1-jhubbard@nvidia.com> <20191113042710.3997854-10-jhubbard@nvidia.com> <20191113104308.GE6367@quack2.suse.cz> From: John Hubbard X-Nvconfidentiality: public Message-ID: <3850aa22-6f03-bd2b-024f-5736c4461199@nvidia.com> Date: Wed, 13 Nov 2019 15:22:34 -0800 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: <20191113104308.GE6367@quack2.suse.cz> 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"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1573687464; bh=1TmaF+0LQcsFxIIl+yPUdlXgPu3Pw2KrYq1UfrZmOD8=; h=X-PGP-Universal:Subject:To:CC:References:From: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=Sgh8xQ9PPxEDYPCTK8yOmdqruurqzstpkQQJWGvT1ZuKvcNIm+LQ3r9aXrqQ9mszQ Bu049858Sw2Icc5D17nHXFv2uQsdcr4xPrIX8xdiYxeSGVqbXJlpqaWLWE4t3jzM99 VuF91a2IBcxPvt3YPz/EF6VJnVwIt20m+YRBQJGScCmijzBCG+FdMVkUIYoHIR7z6o jEChHIr4nyoheDQl2TBz15vaUAtG/VbXtnMxK3XkWyGpUbFva3/BqFu3QAkjswSCIq sTwbFrrL1y3TY1TtnjqKRKFpvyNb5gHvpkqf+On66KeiFfk826TpWgO2QQef8bajR8 NyLLnJaaEwbcQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/13/19 2:43 AM, Jan Kara wrote: ... > How does FOLL_PIN result in grabbing (at least normal, for now) page reference? > I didn't find that anywhere in this patch but it is a prerequisite to > converting any user to pin_user_pages() interface, right? ohhh, I messed up on this intermediate patch: it doesn't quite stand alone as it should, as you noticed. To correct this, I can do one of the following: a) move the new pin*() routines into the later patch 16 ("mm/gup: track FOLL_PIN pages"), or b) do a temporary thing here, such as setting FOLL_GET and adding a TODO, within the pin*() implementations. And this switching it over to FOLL_PIN in patch 16. I'm thinking (a) is less error-prone, so I'm going with that unless someone points out that that is stupid. :) ... > I was somewhat wondering about the number of functions you add here. So we > have:> > pin_user_pages() > pin_user_pages_fast() > pin_user_pages_remote() > > and then longterm variants: > > pin_longterm_pages() > pin_longterm_pages_fast() > pin_longterm_pages_remote() > > and obviously we have gup like: > get_user_pages() > get_user_pages_fast() > get_user_pages_remote() > ... and some other gup variants ... > > I think we really should have pin_* vs get_* variants as they are very > different in terms of guarantees and after conversion, any use of get_* > variant in non-mm code should be closely scrutinized. OTOH pin_longterm_* > don't look *that* useful to me and just using pin_* instead with > FOLL_LONGTERM flag would look OK to me and somewhat reduce the number of > functions which is already large enough? What do people think? I don't feel > too strongly about this but wanted to bring this up. > > Honza Sounds just right to me, and I see that Dan and Ira also like it. So I'll proceed with that. thanks, -- John Hubbard NVIDIA