Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3065379imj; Mon, 11 Feb 2019 13:14:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IY1sp35QgWOY82laXezOnU9puOEmmtj086Dunt9dydqcqRouFM2Fj7C4rL1a0J6IugAHxAW X-Received: by 2002:a62:1303:: with SMTP id b3mr249143pfj.147.1549919665388; Mon, 11 Feb 2019 13:14:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549919665; cv=none; d=google.com; s=arc-20160816; b=x4Y3lkcRRJRC490y4f7avsZGjHKP/DA8b3EHQO6T0W4NDCYw77pDGGBu2P0cL79nPb MxIIOFSxiAHCRc/kwZG7SpRN6ZrjCLrA/09RWTRgyo/aqUzo6BJIsE7EAInhsTLJVHJt WPrezVeqTzGHe3Wf81kXMj/HMG71k1tqO+iOhuMh7lbGTi/tRyZqFQh7JA7dMIxISyA1 C4YqFs91IhqD8DnvrWU1QaEbQGpP4tRpKJ+Dy6rC0f1md677j0srB7pljncEBzTdHpCL vbQybc0NdrJZTBqMHLhQD5ptnxkfRLiKFbfEKl7MEoGyR/mnXFSE9ywEXTonsvY2UOOR LYkA== 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=jCNJwm22GIJyJ9ioZIwP6IZZLdb+CRCGAEh9x8vIK40=; b=HczC5a9+JHgtn5LpI7EDahUZjMlvO/r9gOmB5QJVbaRaXILZcvJL99ju9+NcyLj+LO qrYXaCLpbfZ2dHJLjQ+ILElkj2XBARxZFi/UJ/xgjMynSOuwoNhq/9f36WKF+AIto7+H eZ4mbNHIeX51iMkJfjIy1Asdj+4TimT69HkuZiQrGC28sRFvqfxoWgVihbDTHVlP51hq 8pRcjd+9nVq6UAjyIYJgYl/dIqFTeW4CVlOdJ8gFf+paIaJ6lXrzGrzvZpxn/Ps3XgtH g5pLoQOjdnrFM1F+Z5UkwbwfV7MHwTz6U6ZD5UXDlt/pMj8zkvjrOeePp6wnEYCkqS62 4bEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=F2wnBIUI; 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 q4si11603912pfq.56.2019.02.11.13.14.09; Mon, 11 Feb 2019 13:14:25 -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=F2wnBIUI; 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 S1727350AbfBKVOE (ORCPT + 99 others); Mon, 11 Feb 2019 16:14:04 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:2296 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbfBKVOD (ORCPT ); Mon, 11 Feb 2019 16:14:03 -0500 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 11 Feb 2019 13:13:58 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 11 Feb 2019 13:13:57 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 11 Feb 2019 13:13:57 -0800 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 11 Feb 2019 21:13:57 +0000 Subject: Re: [PATCH 2/3] mm/gup: Introduce get_user_pages_fast_longterm() To: Jason Gunthorpe , CC: , , , Daniel Borkmann , Davidlohr Bueso , , Mike Marciniszyn , Dennis Dalessandro , Doug Ledford , Andrew Morton , "Kirill A. Shutemov" , Dan Williams References: <20190211201643.7599-1-ira.weiny@intel.com> <20190211201643.7599-3-ira.weiny@intel.com> <20190211203916.GA2771@ziepe.ca> X-Nvconfidentiality: public From: John Hubbard Message-ID: Date: Mon, 11 Feb 2019 13:13:56 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190211203916.GA2771@ziepe.ca> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL108.nvidia.com (172.18.146.13) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8" Content-Language: en-US-large Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1549919638; bh=jCNJwm22GIJyJ9ioZIwP6IZZLdb+CRCGAEh9x8vIK40=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=F2wnBIUIyRcBk9XPZBwpp+6XeprxUtoGbDdGoNtn6k9OQQtZ9hMy5XhGDUFmFyQvs Cu4YHNkIG9qjaEMUQRhkvvSf6cPgpUW2gmtvWNL+JD0qKEsXO1dtgAKkGacgp3a61z hDrnGMFtLb6t8+segCjn0hgTBqZawFIRjqtd2pbLIpINclPAYE7V/jLZ3XWY+1RIYS Wb23jh/Eent8W8fBllFt3+5gBhmFuUN1816D0bLEeGbozqN0PoFUTf21suiDx53cUq mbkf2aV9MvY/0qnZtPfLUUi7+mmxWEN7SRwLDUmyfCOq+aEEkWj1a6xvxBd0MgIHbx odNPsrr5kqBmg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/11/19 12:39 PM, Jason Gunthorpe wrote: > On Mon, Feb 11, 2019 at 12:16:42PM -0800, ira.weiny@intel.com wrote: >> From: Ira Weiny [...] >> +static inline int get_user_pages_fast_longterm(unsigned long start, int nr_pages, >> + bool write, struct page **pages) >> +{ >> + return get_user_pages_fast(start, nr_pages, write, pages); >> +} >> #endif /* CONFIG_FS_DAX */ >> >> int get_user_pages_fast(unsigned long start, int nr_pages, int write, >> @@ -2615,6 +2622,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, >> #define FOLL_REMOTE 0x2000 /* we are working on non-current tsk/mm */ >> #define FOLL_COW 0x4000 /* internal GUP flag */ >> #define FOLL_ANON 0x8000 /* don't do file mappings */ >> +#define FOLL_LONGTERM 0x10000 /* mapping is intended for a long term pin */ > > If we are adding a new flag, maybe we should get rid of the 'longterm' > entry points and just rely on the callers to pass the flag? > > Jason > +1, I agree that the overall get_user_pages*() API family will be cleaner *without* get_user_pages_longterm*() calls. And this new flag makes that possible. So I'd like to see the "longerm" call replaced with just passing this flag. Maybe even as part of this patchset, but either way. Taking a moment to reflect on where I think this might go eventually (the notes below do not need to affect your patchset here, but this seems like a good place to mention this): It seems to me that the longterm vs. short-term is of questionable value. It's actually better to just call get_user_pages(), and then if it really is long-term enough to matter internally, we'll see the pages marked as gup-pinned. If the gup pages are released before anyone (filesystem, that is) notices, then it must have been short term. Doing it that way is self-maintaining. Of course, this assumes that we end up with a design that doesn't require being told, by the call sites, that a given gup call is intended for "long term" use. So I could be wrong about this direction, but let's please consider the possibility. thanks, -- John Hubbard NVIDIA