Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp64525ybx; Thu, 31 Oct 2019 16:01:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXYrrbsPH5padGGWrP7L9b+P6tXoSPhJEUZoLAlOTLInIaJC/qY146CINaoaufCMWBolmY X-Received: by 2002:a17:906:80d1:: with SMTP id a17mr6539527ejx.77.1572562894711; Thu, 31 Oct 2019 16:01:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572562894; cv=none; d=google.com; s=arc-20160816; b=UU4ZiYofIZd0HBuXjFCzLc65kJXEd0BARSeYeEO4szStFpoVcDA6/JoAuvRVLQhUr4 GiMsrHzfuf+FTh8g5/fE49s77lkHtfn6vFfL3SJP5bpEqpnCSl0FpcmWNtZrtZVHP4IG /7pT4u6NgEqa3Xye7q8MGgWC/AWOBzNiNNq58bMnOLWY4V9T3ZfFNUO6FapOlmiPAF+Z GzgFf1pcvwTYwUPqQuLWRCaX/G4RUdoUm8DyLq4JNztVLD+gGKLkhpgxOlm7n1nFtqEj OjDq1Zl9oc/Ce4Ji7ZUID94+C8+6ZtZUnTzyiZn35DtiyyZcsjWygym41o2v/yuioojU VumA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=c8HttT1T3U+ZTLW69hILmDnuPRctoCffgOQnWmjjfdE=; b=V6NCjl4OielTGQ7q1RN5O8GZ2LYsUl2Uv9AAkpIZvBfg7ljxIWeGS/0LMyafdeA6Ca VBtdBtLXYkQ/455cjuh1wUJNSs0d0LPZGOlRQNwHLCN+AevKERURQOHAX5HihFkTiSoM Bd7CR0rQcNkuJZud3c4j1W2O4kAWD8QTYdrFO7dxfNWtL3Vz7wrEuXNbc0N0jjn1nN/t WcjrwyIXIo58+95vgJsPM9jV/+2iHsHKXG6fPIfB8G4vmeWYpjx77fQ2DuDfmLKJ5ej1 eZ4LmFZi77iuekKSIQeLhjQpd5bDMjiv1y+u04fMzMZ7ahajuRHvYD+ngp6BlFC8Jk3t ZwBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="bP/zDnr+"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p7si2434671edq.227.2019.10.31.16.01.10; Thu, 31 Oct 2019 16:01:34 -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; dkim=pass header.i=@nvidia.com header.s=n1 header.b="bP/zDnr+"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727529AbfJaWg1 (ORCPT + 99 others); Thu, 31 Oct 2019 18:36:27 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:16672 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbfJaWg0 (ORCPT ); Thu, 31 Oct 2019 18:36:26 -0400 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== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > * >