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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 F05FCC433E0 for ; Sat, 23 May 2020 17:25:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B19E2207F7 for ; Sat, 23 May 2020 17:25:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="UCHXLaK1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B19E2207F7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3B27080008; Sat, 23 May 2020 13:25:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 363B280007; Sat, 23 May 2020 13:25:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2521A80008; Sat, 23 May 2020 13:25:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id 0B6EE80007 for ; Sat, 23 May 2020 13:25:40 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BB10B4995E0 for ; Sat, 23 May 2020 17:25:39 +0000 (UTC) X-FDA: 76848660798.14.fish59_6b9d657df194d X-HE-Tag: fish59_6b9d657df194d X-Filterd-Recvd-Size: 3661 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Sat, 23 May 2020 17:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=CVNRhNLnfmlc2qa/qQiHI89PDUvBGY/AKeK4xvPMuyA=; b=UCHXLaK1YXp36y/WDD9cfsgfbN q54HO+/Y1Gem3JnXF8A7Qw33ZANMQEd4bL344Y8D2kBovzFVSHBVrajRPNX1KprdiEPCXgjvMujSH +E4gYyfQ1olJkeMcGn1BCieZSHDIGpcBU02O+4+VWWiKGGdGQHhQifrU4wb4PR3Rp4KevpLdNl4/b q4tpWZBFoEtKcjmRvPyBjQXe0C292c7A6fBUDivplEOpxv5wr464i6p5pepBW8XFCjTeDUx7BoiJ0 qDBwA+/cZrAFMOVCIE8YsMVccyXo2Vr0MeMI2zR76BC1CtRI7Z8J0t2Ba+9HltIw5oNOgC4VbsCsx QwNAlymw==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jcXtf-0000Up-7w; Sat, 23 May 2020 17:25:19 +0000 Date: Sat, 23 May 2020 10:25:19 -0700 From: Matthew Wilcox To: Souptick Joarder Cc: paulus@ozlabs.org, mpe@ellerman.id.au, benh@kernel.crashing.org, akpm@linux-foundation.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, namhyung@kernel.org, pbonzini@redhat.com, sfr@canb.auug.org.au, rppt@linux.ibm.com, msuchanek@suse.de, aneesh.kumar@linux.ibm.com, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, John Hubbard Subject: Re: [linux-next RFC] mm/gup.c: Convert to use get_user_pages_fast_only() Message-ID: <20200523172519.GA17206@bombadil.infradead.org> References: <1590252072-2793-1-git-send-email-jrdr.linux@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1590252072-2793-1-git-send-email-jrdr.linux@gmail.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 Sat, May 23, 2020 at 10:11:12PM +0530, Souptick Joarder wrote: > Renaming the API __get_user_pages_fast() to get_user_pages_ > fast_only() to align with pin_user_pages_fast_only(). Please don't split a function name across lines. That messes up people who are grepping for the function name in the changelog. > As part of this we will get rid of write parameter. > Instead caller will pass FOLL_WRITE to get_user_pages_fast_only(). > This will not change any existing functionality of the API. > > All the callers are changed to pass FOLL_WRITE. > > Updated the documentation of the API. Everything you have done here is an improvement, and I'd be happy to see it go in (after fixing the bug I note below). But in reading through it, I noticed almost every user ... > - if (__get_user_pages_fast(hva, 1, 1, &page) == 1) { > + if (get_user_pages_fast_only(hva, 1, FOLL_WRITE, &page) == 1) { passes '1' as the second parameter. So do we want to add: static inline bool get_user_page_fast_only(unsigned long addr, unsigned int gup_flags, struct page **pagep) { return get_user_pages_fast_only(addr, 1, gup_flags, pagep) == 1; } > @@ -2797,10 +2803,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, > * FOLL_FAST_ONLY is required in order to match the API description of > * this routine: no fall back to regular ("slow") GUP. > */ > - unsigned int gup_flags = FOLL_GET | FOLL_FAST_ONLY; > - > - if (write) > - gup_flags |= FOLL_WRITE; > + gup_flags = FOLL_GET | FOLL_FAST_ONLY; Er ... gup_flags |=, surely?