Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp898172ybx; Wed, 30 Oct 2019 06:55:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOoq7D3Q0GkK6le6AGcioObW8eTED39XpepVIDFaLq7bQv3op8sFqzFs7nlWnx3b3joTIw X-Received: by 2002:a50:d7c9:: with SMTP id m9mr32422165edj.93.1572443741994; Wed, 30 Oct 2019 06:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572443741; cv=none; d=google.com; s=arc-20160816; b=O5CyljEYJ9zQjZh3ELqQ18hnUBGGyWMtuDJ6ifJYSjrr83Gn8mR29ow93cHnuzIK/V 16WPwLiy6iZ8qi+uLDWXHC8j6j+OQ9bEX7jqV6CXlG/scZxqIRSFImtUfcWxrl9qK1yG pNaQ9qoueg4n1X/j0Y63pJXnamV56JDevIjG6OUPzfo2iHTpUv7Xb1aq55Oa3wLKeaLb I0RJ+st+ac41dMaij4/kbY8bQ/+wfryAsY0DMbJqKoGQxvuCoe+fl9k5EF4WEdy0mAdP 53GaqJPoaOiG7s8qoyQ0tttMQ2BuMI/PHE5+U66R5uA8f1WP5jNSlso/XYLHpFrCVgmb u0ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=D9xzSNo4lyb0XsNSu35LY5hNsge3yN4PLvpG+02O1og=; b=cp3TavLKKvUgQ3flZMkRRrVwK/IceMjvErtRdRUyRrImgPtXJF1pK5bWr+D1x1Y9hW f9McQ9F6KDlhTFn4KUjSBLTavJ60PKKTl0uucDUh4sT6fXR3PXnrYnY8mqSBulNbe838 d/5rxWWjd/v+1frZ3+ToGiOHAuSQhEAjqFqTbkf7c3JU35la7aLQdrwEX0Pw4bol5HYU 8JCMelo4nSCj3tygH/3zHnKGgaAj95uz5e3TXPY1/EF1TWwcCajv0tJOu5sv9yy5dUGE gyCzHnW8z6n/TjQ0mEDuOUKzrxAuFQJbn2mlGjpAfP/OnVQjL4bGVAGhBZEGMBzQAXQ6 G1Ug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=126.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si1213559ejr.53.2019.10.30.06.55.17; Wed, 30 Oct 2019 06:55:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=126.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726706AbfJ3NwX (ORCPT + 99 others); Wed, 30 Oct 2019 09:52:23 -0400 Received: from out28-125.mail.aliyun.com ([115.124.28.125]:51445 "EHLO out28-125.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726246AbfJ3NwV (ORCPT ); Wed, 30 Oct 2019 09:52:21 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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