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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,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 28BEFC433E1 for ; Mon, 25 May 2020 06:05:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA6AC2084C for ; Mon, 25 May 2020 06:05:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ehQSl2w9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA6AC2084C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1DA4B8001A; Mon, 25 May 2020 02:05:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 163A38000E; Mon, 25 May 2020 02:05:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 003FE8001A; Mon, 25 May 2020 02:05:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id D9E498000E for ; Mon, 25 May 2020 02:05:05 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 91E7B824556B for ; Mon, 25 May 2020 06:05:05 +0000 (UTC) X-FDA: 76854203370.08.shade75_669bdf7de1240 X-HE-Tag: shade75_669bdf7de1240 X-Filterd-Recvd-Size: 6425 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 May 2020 06:05:04 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id v16so19464287ljc.8 for ; Sun, 24 May 2020 23:05:04 -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=yBEIyGoELaaD+alubGuUtHR8SFOTBJNSGDV1DmXECiU=; b=ehQSl2w9nY5dfRV6wriDcpTZGCg4P5IKERzl8jgDRtg3uhpkzAwd3ER92Qp5OiHoL/ +MhqCnu8zW56GE60KkTpJ3oxdAr6etM08OheP4CCIkAn/xtpCdIWN8MBUnqveJ5A4gLK RxkTpS7YVbBXUhcNkQ0TNE9KA9K4ocnXhAr9Xa3XG9LmJrZ/GQj5cA/ExPP8Fd98XPTh m6maZFzKLWQYjHH2rRA/tj3ZfnY7463WV62NMrjiV1kJ8DIfE1/EJlw3GwWSPvhUcvDT 16JRko4weBL9UUlbBUdoncQNMaTcFehwoljIqIq6/MYZcwy7q9UKtzsmUWudXb5uw850 eMlg== 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=yBEIyGoELaaD+alubGuUtHR8SFOTBJNSGDV1DmXECiU=; b=SJwBhQe1g1w+tJ2b5nG2xdJ0/E7d/qj7EG3fJlaf98e9JNj22NPV9fhV+EF3sJvN+o NVexZUzjsQpNNgrMJbm/aZd9VQnvq9JoPeQUtwTWD2o7yosixsGuYDZmj43tjANR964o jLey4mV4AT1N/6qawXzzSIxg/yDbUQ3HtBlOinyFpAGwst1yY1xj3Ch/xHbwSNlVqLzF iSzTNAtSioknV7eBqeVzwh+EMmQ/Mjm5HPJolApY58wjBy72Ytz8RILGmdCMU94DzWrX k0fuuN/SWZFTf0WdvPS6k4IcCZhreynduFjCQ3r0fBuNZaezJV3KDCXIITJLEAvzSb5b b/YA== X-Gm-Message-State: AOAM5327Rh9kHQj3zZUi6w8/dSjT9/n6Mw8YZXPfi/r9kWKq/0Mp1mGo O4uBJEX90T6Ev1RiZtQaock1mlus73849GKQkrM= X-Google-Smtp-Source: ABdhPJwOO/TJa9JhhYdJXPau2E/wFjjcMVGycTDzEnfXyjgQyMTqifURPEuLOUykpugkn4KaOaj319Yr0zMyHaEJvV8= X-Received: by 2002:a2e:b16e:: with SMTP id a14mr12277083ljm.70.1590386703464; Sun, 24 May 2020 23:05:03 -0700 (PDT) MIME-Version: 1.0 References: <1590294434-19125-1-git-send-email-jrdr.linux@gmail.com> In-Reply-To: From: Souptick Joarder Date: Mon, 25 May 2020 11:43:08 +0530 Message-ID: Subject: Re: [linux-next RFC v2] mm/gup.c: Convert to use get_user_{page|pages}_fast_only() To: John Hubbard Cc: Paul Mackerras , Michael Ellerman , Benjamin Herrenschmidt , Andrew Morton , Peter Zijlstra , Ingo Molnar , acme@kernel.org, Mark Rutland , Alexander Shishkin , jolsa@redhat.com, namhyung@kernel.org, pbonzini@redhat.com, Stephen Rothwell , Mike Rapoport , "Aneesh Kumar K.V" , msuchanek@suse.de, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Linux-MM , kvm@vger.kernel.org, Matthew Wilcox Content-Type: text/plain; charset="UTF-8" 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 Mon, May 25, 2020 at 6:36 AM John Hubbard wrote: > > On 2020-05-23 21:27, Souptick Joarder wrote: > > API __get_user_pages_fast() renamed to get_user_pages_fast_only() > > to align with pin_user_pages_fast_only(). > > > > 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. > > This looks good. A few nits below, but with those fixed, feel free to > add: > > Reviewed-by: John Hubbard > > > > > There are few places where 1 is passed to 2nd parameter of > > __get_user_pages_fast() and return value is checked for 1 > > like [1]. Those are replaced with new inline > > get_user_page_fast_only(). > > > > [1] if (__get_user_pages_fast(hva, 1, 1, &page) == 1) > > > > We try to avoid talking *too* much about the previous version of > the code. Just enough. So, instead of the above two paragraphs, > I'd compress it down to: > > Also: introduce get_user_page_fast_only(), and use it in a few > places that hard-code nr_pages to 1. > > ... > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index 93d93bd..8d4597f 100644 > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > @@ -1817,10 +1817,16 @@ extern int mprotect_fixup(struct vm_area_struct *vma, > > /* > > * doesn't attempt to fault and will return short. > > */ > > -int __get_user_pages_fast(unsigned long start, int nr_pages, int write, > > - struct page **pages); > > +int get_user_pages_fast_only(unsigned long start, int nr_pages, > > + unsigned int gup_flags, struct page **pages); > > Silly nit: > > Can you please leave the original indentation in place? I don't normally > comment about this, but I like the original indentation better, and it matches > the pin_user_pages_fast() below, too. > > ... > > @@ -2786,8 +2792,8 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages, > > * If the architecture does not support this function, simply return with no > > * pages pinned. > > */ > > -int __get_user_pages_fast(unsigned long start, int nr_pages, int write, > > - struct page **pages) > > +int get_user_pages_fast_only(unsigned long start, int nr_pages, > > + unsigned int gup_flags, struct page **pages) > > > Same thing here: you've changed the original indentation, which was (arguably, but > to my mind anyway) more readable, and for no reason. It still would have fit within > 80 cols. > > I'm sure it's a perfect 50/50 mix of people who prefer either indentation style, and > so for brand new code, I'll remain silent, as long as it is consistent with either > itself and/or the surrounding code. But changing it back and forth is a bit > aggravating, and best avoided. :) Ok, along with these changes I will remove the *RFC* tag and repost it.