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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 B3E0EC432C0 for ; Sun, 1 Dec 2019 01:49:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6818F2086A for ; Sun, 1 Dec 2019 01:49:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="SwDju6Lh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6818F2086A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 18F526B0278; Sat, 30 Nov 2019 20:49:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 119F36B0279; Sat, 30 Nov 2019 20:49:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFCDB6B027A; Sat, 30 Nov 2019 20:49:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id D84E46B0278 for ; Sat, 30 Nov 2019 20:49:55 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 8D06440F1 for ; Sun, 1 Dec 2019 01:49:55 +0000 (UTC) X-FDA: 76214891550.10.edge37_90d477250a92b X-HE-Tag: edge37_90d477250a92b X-Filterd-Recvd-Size: 4289 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Sun, 1 Dec 2019 01:49:55 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B867215A5; Sun, 1 Dec 2019 01:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575164994; bh=wPACwLULN6vw5l/eLSSEOzRjlJhLORKDVYnHUAmQ8dg=; h=Date:From:To:Subject:From; b=SwDju6Lhc1XcHkt1fQ+/e/tPAzyM6+n8lp+2AsHqIRNXhroEkjVpOv34vX6ipYWgU CdM4CkzGUeEl/dJjK7D2j8kwxrAVAL7tzelDWC40tG+0y+oHe7sD1AMuy9QzeQFKWA 4F2eRYekaokMF5x6546MvpG/5T70U7OaxZKTBC0Q= Date: Sat, 30 Nov 2019 17:49:53 -0800 From: akpm@linux-foundation.org To: akpm@linux-foundation.org, david@redhat.com, jhubbard@nvidia.com, linux-mm@kvack.org, liuxiang_1999@126.com, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 015/158] mm/gup.c: fix comments of __get_user_pages() and get_user_pages_remote() Message-ID: <20191201014953.VXu3YPS4P%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 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: From: Liu Xiang Subject: mm/gup.c: fix comments of __get_user_pages() and get_user_pages_remote() Fix comments of __get_user_pages() and get_user_pages_remote(), make them more clear. Link: http://lkml.kernel.org/r/1572443533-3118-1-git-send-email-liuxiang_1999@126.com Signed-off-by: Liu Xiang Suggested-by: John Hubbard Reviewed-by: David Hildenbrand Reviewed-by: John Hubbard Signed-off-by: Andrew Morton --- mm/gup.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) --- a/mm/gup.c~mm-gup-fix-comments-of-__get_user_pages-and-get_user_pages_remote +++ a/mm/gup.c @@ -734,11 +734,17 @@ static int check_vma_flags(struct vm_are * 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_p * 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. * _