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=-9.7 required=3.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT 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 316ACCA9EC5 for ; Wed, 30 Oct 2019 13:52:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F0CEE20874 for ; Wed, 30 Oct 2019 13:52:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0CEE20874 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=126.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8B4F66B0008; Wed, 30 Oct 2019 09:52:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 866006B000A; Wed, 30 Oct 2019 09:52:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77BE06B000C; Wed, 30 Oct 2019 09:52:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id 562316B0008 for ; Wed, 30 Oct 2019 09:52:35 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id E119E3D01 for ; Wed, 30 Oct 2019 13:52:34 +0000 (UTC) X-FDA: 76100591028.14.books47_508e980077850 X-HE-Tag: books47_508e980077850 X-Filterd-Recvd-Size: 3807 Received: from out28-99.mail.aliyun.com (out28-99.mail.aliyun.com [115.124.28.99]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Oct 2019 13:52:33 +0000 (UTC) X-Alimail-AntiSpam:AC=CONTINUE;BC=0.09516023|-1;CH=green;DM=CONTINUE|CONTINUE|true|0.224792-0.0144767-0.760731;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03291;MF=liu.xiang@zlingsmart.com;NM=1;PH=DS;RN=4;RT=4;SR=0;TI=SMTPD_---.FsZxaJ3_1572443539; Received: from localhost(mailfrom:liu.xiang@zlingsmart.com fp:SMTPD_---.FsZxaJ3_1572443539) by smtp.aliyun-inc.com(10.194.98.253); Wed, 30 Oct 2019 21:52:19 +0800 From: Liu Xiang To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, jhubbard@nvidia.com, liuxiang_1999@126.com Subject: [PATCH v3] mm: gup: fix comments of __get_user_pages() and get_user_pages_remote() Date: Wed, 30 Oct 2019 21:52:13 +0800 Message-Id: <1572443533-3118-1-git-send-email-liuxiang_1999@126.com> X-Mailer: git-send-email 1.9.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000146, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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(-) 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. * -- 1.9.1