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=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 7D67DCA9ECF for ; Thu, 31 Oct 2019 22:36:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3FDEA20873 for ; Thu, 31 Oct 2019 22:36:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="bP/zDnr+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FDEA20873 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D9E266B0005; Thu, 31 Oct 2019 18:36:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4CF86B0006; Thu, 31 Oct 2019 18:36:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C635D6B0007; Thu, 31 Oct 2019 18:36:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id A574A6B0005 for ; Thu, 31 Oct 2019 18:36:28 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 1CCDC81D8 for ; Thu, 31 Oct 2019 22:36:28 +0000 (UTC) X-FDA: 76105540056.17.cub58_3862310ba9825 X-HE-Tag: cub58_3862310ba9825 X-Filterd-Recvd-Size: 5411 Received: from hqemgate14.nvidia.com (hqemgate14.nvidia.com [216.228.121.143]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Thu, 31 Oct 2019 22:36:27 +0000 (UTC) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 31 Oct 2019 15:36:32 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 31 Oct 2019 15:36:26 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 31 Oct 2019 15:36:26 -0700 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 31 Oct 2019 22:36:25 +0000 Subject: Re: [PATCH v3] mm: gup: fix comments of __get_user_pages() and get_user_pages_remote() To: Liu Xiang , CC: References: <1572443533-3118-1-git-send-email-liuxiang_1999@126.com> From: John Hubbard Message-ID: <97e9ade2-609d-504a-f5cb-e64f01826a4b@nvidia.com> Date: Thu, 31 Oct 2019 15:36:25 -0700 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: <1572443533-3118-1-git-send-email-liuxiang_1999@126.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1572561392; bh=c8HttT1T3U+ZTLW69hILmDnuPRctoCffgOQnWmjjfdE=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=bP/zDnr+IV8RBp6yeyTwNn8XGoaW4shXs3D3OgQHOL8SJGZgmYURzN1ZM3sgnxLmz TF7osmvq3QOQWBb5nGIkqR+2HX+V8+HFWs2AK4NZMnqjqThxpzoal9NLxBCdR904Tg tQJqZBBbNAkEy1VXBJ9212H1WUgNT5ji5FOQLxIzgbYbVahwYrf1MMPPA3gaBZxCC/ mMXdn8LP+/iMUn3m3KwCfB9A9lk9ZD+dt8qRldo3liD32LLXv1QGfFGZ+aj00+RJZm kuaBcmm88l4RSASRIzgURE/DSm/z8ChZunQVc1MucMgdzsIwa6PAVddJK+6FE6fKfw o6TP/XmlptQ9w== 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 10/30/19 6:52 AM, Liu Xiang wrote: > Fix comments of __get_user_pages() and get_user_pages_remote(), > make them more clear. > > Suggested-by: John Hubbard > Signed-off-by: Liu Xiang > > --- > > Changes in v3: > as suggested by John, apply the same fix to get_user_pages_remote(). > --- > mm/gup.c | 32 ++++++++++++++++++++++---------- > 1 file changed, 22 insertions(+), 10 deletions(-) Reviewed-by: John Hubbard thanks, -- John Hubbard NVIDIA > > diff --git a/mm/gup.c b/mm/gup.c > index 8f236a3..c36c621 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -734,11 +734,17 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags) > * Or NULL if the caller does not require them. > * @nonblocking: whether waiting for disk IO or mmap_sem contention > * > - * Returns number of pages pinned. This may be fewer than the number > - * requested. If nr_pages is 0 or negative, returns 0. If no pages > - * were pinned, returns -errno. Each page returned must be released > - * with a put_page() call when it is finished with. vmas will only > - * remain valid while mmap_sem is held. > + * Returns either number of pages pinned (which may be less than the > + * number requested), or an error. Details about the return value: > + * > + * -- If nr_pages is 0, returns 0. > + * -- If nr_pages is >0, but no pages were pinned, returns -errno. > + * -- If nr_pages is >0, and some pages were pinned, returns the number of > + * pages pinned. Again, this may be less than nr_pages. > + * > + * The caller is responsible for releasing returned @pages, via put_page(). > + * > + * @vmas are valid only as long as mmap_sem is held. > * > * Must be called with mmap_sem held. It may be released. See below. > * > @@ -1107,11 +1113,17 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk, > * subsequently whether VM_FAULT_RETRY functionality can be > * utilised. Lock must initially be held. > * > - * Returns number of pages pinned. This may be fewer than the number > - * requested. If nr_pages is 0 or negative, returns 0. If no pages > - * were pinned, returns -errno. Each page returned must be released > - * with a put_page() call when it is finished with. vmas will only > - * remain valid while mmap_sem is held. > + * Returns either number of pages pinned (which may be less than the > + * number requested), or an error. Details about the return value: > + * > + * -- If nr_pages is 0, returns 0. > + * -- If nr_pages is >0, but no pages were pinned, returns -errno. > + * -- If nr_pages is >0, and some pages were pinned, returns the number of > + * pages pinned. Again, this may be less than nr_pages. > + * > + * The caller is responsible for releasing returned @pages, via put_page(). > + * > + * @vmas are valid only as long as mmap_sem is held. > * > * Must be called with mmap_sem held for read or write. > * >