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.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 A15ECC433DF for ; Sat, 23 May 2020 19:29:07 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 157CB2073B for ; Sat, 23 May 2020 19:29:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SDwq+vPL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 157CB2073B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49TthJ4Dz3zDqgq for ; Sun, 24 May 2020 05:29:04 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::241; helo=mail-lj1-x241.google.com; envelope-from=jrdr.linux@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=SDwq+vPL; dkim-atps=neutral Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49TtfT5S36zDqd7 for ; Sun, 24 May 2020 05:27:27 +1000 (AEST) Received: by mail-lj1-x241.google.com with SMTP id l15so16242004lje.9 for ; Sat, 23 May 2020 12:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4zh7dLGu7lIkgyTn7FvmIN1ENGY6DqOeI+3TT5hxCt0=; b=SDwq+vPLA0VttbVnCIyh849cyujPiB4Sr5VE3OMr00ndVG07fQzr9R15FPIx1iqUtW P77gdjZKGBER/wOo6ZfKLZ/MnwEYUsOS6LA6V/sWnAI3xblDIvlXaLbXny+B/Ku6NhEC PyMTCg7+1GU1lZL8KcMSVdNbebuXR0Nv3iNLHgWmvgfoOqq9fe2DbeGW8rHwd/rLn3Hc 6p7pWKUCNCOwYj7fdyTkYx7ypzcitzJAhMGkoXfv8S8zUTNoaJQAnuWwIa4TQjSyu8R9 aULDf1WC3dkaxWC6o9AnAWGp4HZdj6nTR+qk+RmpStevnJIqDgbfmmrMOwbA1RLcLBRk fOJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4zh7dLGu7lIkgyTn7FvmIN1ENGY6DqOeI+3TT5hxCt0=; b=fAFwRVBFoJ6abK3P5BWp/pfCEXlW2owcbPS3MkbPTgp1DHsDcVKTD0AnxNI1v6TqDK YJdxkWU93dEy0ZSoIZ85mgn9e7IVJZgmYmO8wa8NjeuMYIMeCIfwnKdmOlYiuLIkMLmZ pl7omjY2WcSxVlX7pwVlM6ZK3LhxUMXuCgIo4U1kaOMpO28kzTk81UZpwY98Qo3HE1zo 5+VKOyspGAl2gCpY3yVPLk74E6Z4GnylChbm01DFHIKHr/VBaQu1nWAkn5vdYSDTISMg 9SRkf623J/wMJHdSObAlXh3DtW4W3/a8px3FcARaCexg6saRmczmDa1iRD+1xrpmOKy3 gcZg== X-Gm-Message-State: AOAM530FPzqXwwFoDqKeRC2uTj2lttGzK+ijJ0g+z69dvXzaPFV+S/Tj gQQsa0n5O0n0sWF25peRF6dKERsMsj5ZHDVgiQI= X-Google-Smtp-Source: ABdhPJx/aePhkdk7Qd1gPorTLl+bFXIeiWFXCUwHcB1sqn3tOPAQvRYi6F02pl0bBHDR2PIWoOrdqQ4l/KajgyWOA64= X-Received: by 2002:a2e:99cd:: with SMTP id l13mr10155778ljj.257.1590262043781; Sat, 23 May 2020 12:27:23 -0700 (PDT) MIME-Version: 1.0 References: <1590252072-2793-1-git-send-email-jrdr.linux@gmail.com> <20200523172519.GA17206@bombadil.infradead.org> In-Reply-To: <20200523172519.GA17206@bombadil.infradead.org> From: Souptick Joarder Date: Sun, 24 May 2020 01:05:28 +0530 Message-ID: Subject: Re: [linux-next RFC] mm/gup.c: Convert to use get_user_pages_fast_only() To: Matthew Wilcox Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Stephen Rothwell , kvm@vger.kernel.org, pbonzini@redhat.com, Linux-MM , Peter Zijlstra , kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, acme@kernel.org, Mike Rapoport , Alexander Shishkin , Ingo Molnar , "Aneesh Kumar K.V" , John Hubbard , namhyung@kernel.org, Andrew Morton , msuchanek@suse.de, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Sat, May 23, 2020 at 10:55 PM Matthew Wilcox wrote: > > 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. Ok. > > > 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; > } > Yes, this can be added. Does get_user_page_fast_only() naming is fine ? > > @@ -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? Poor mistake. @@ -1998,7 +1998,7 @@ int gfn_to_page_many_atomic(struct kvm_memory_slot *slot, gfn_t gfn, if (entry < nr_pages) return 0; - return __get_user_pages_fast(addr, nr_pages, 1, pages); + return get_user_pages_fast(addr, nr_pages, FOLL_WRITE, pages); Also this needs to be corrected.