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.5 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,USER_AGENT_GIT autolearn=ham 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 29393CA9EAF for ; Thu, 24 Oct 2019 15:04:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E08172070B for ; Thu, 24 Oct 2019 15:04:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E08172070B 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 8EE5D6B0006; Thu, 24 Oct 2019 11:04:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 89E6E6B0007; Thu, 24 Oct 2019 11:04:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B4336B0008; Thu, 24 Oct 2019 11:04:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id 5970F6B0006 for ; Thu, 24 Oct 2019 11:04:48 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id E34429084 for ; Thu, 24 Oct 2019 15:04:47 +0000 (UTC) X-FDA: 76079000214.11.cart83_46d22763d5655 X-HE-Tag: cart83_46d22763d5655 X-Filterd-Recvd-Size: 2586 Received: from out28-220.mail.aliyun.com (out28-220.mail.aliyun.com [115.124.28.220]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Thu, 24 Oct 2019 15:04:46 +0000 (UTC) X-Alimail-AntiSpam:AC=CONTINUE;BC=0.1422553|-1;CH=green;DM=CONTINUE|CONTINUE|true|0.217482-0.0138334-0.768685;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_---.FppA4zP_1571929478; Received: from localhost(mailfrom:liu.xiang@zlingsmart.com fp:SMTPD_---.FppA4zP_1571929478) by smtp.aliyun-inc.com(10.194.97.171); Thu, 24 Oct 2019 23:04:38 +0800 From: Liu Xiang To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, jhubbard@nvidia.com, liuxiang_1999@126.com Subject: [PATCH v2] mm: gup: fix comment of __get_user_pages() Date: Thu, 24 Oct 2019 23:04:32 +0800 Message-Id: <1571929472-3091-1-git-send-email-liuxiang_1999@126.com> X-Mailer: git-send-email 1.9.1 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: Fix comment of __get_user_pages() and make it more clear. Suggested-by: John Hubbard Signed-off-by: Liu Xiang --- Changes in v2: as suggested by John, rewrite the comment about return value. mm/gup.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 8f236a3..bc6a254 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. * -- 1.9.1