Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3949850ybg; Fri, 25 Oct 2019 11:10:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUx7EuUdIQw6+2Zof3civ08zKWhRmuKVRNPH18sDxExbjNO2D5DIZQRlpEWtLlsgOapz0J X-Received: by 2002:a17:906:1e55:: with SMTP id i21mr4915860ejj.47.1572026999945; Fri, 25 Oct 2019 11:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572026999; cv=none; d=google.com; s=arc-20160816; b=hV1Mn7VQdCzTnLx5DNxVqM1aNwp8S0WistZs50G89SnfXCwK3Q+8ckE9fTU0JGM91m 7NkyenUyCvUM7zqQp87+zCj/I9vMIWFhoBAhNZ98QAYO+agv7Pf+NgyTv3QsNVRORJ9R okIS+DC8GnIIkWo2I5B0vr/AuGDcmcBHwzlLIMOy8HHnmTrfk6Y0D1euL8WPRAV6Wh/2 VZhdm7kuwN2WaOXLZ/XIU8n/vK0Es+gRsZCk4RTR7uypRNnps6FSUdzWGgUsNkn0rQwi HbUIodTwTF84mRolvAoGahhPoRlQYPMFvb0U0JRPGvBE1+ZLWfjnv+DeItVPRNxniqoi 8Q5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=e36bYgYxzu96VpgkIyu2LKZbHdlezcwFd45XXmtDKSI=; b=UHBt2kQWl+uRtJ9oIevdMY08sxqnz+xLvWQdjk/QY6arCi3Sm36+SrZ5yeccE0ukIm S//QQA1bt0rhCP8NgMkQUdE1aERlmGCCI1aOuXG+jbpzyvEZ1cjLtHmA7ArHYnO/DACk Xjph958VB6HIdeD1LtG8Qfg5efKlFQEwSouEfhfexI6PnVYNhWzj9KSOdVJxNnX5Letp bBPSF937dLZdOv3gzsFZ0BkFJcCVhrwBMXG8Ve6myR0cOgPHyVuK36nboAmHufQA01KA R0IWD57HTNK/1aEz31H7VvikDWEBHtgUN+hLCtShu/P3FkOQYf9B2C3zttA0PUvSFHWr csMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DvTRy4gk; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k35si1962691edb.84.2019.10.25.11.09.36; Fri, 25 Oct 2019 11:09:59 -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=@redhat.com header.s=mimecast20190719 header.b=DvTRy4gk; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436681AbfJXQKb (ORCPT + 99 others); Thu, 24 Oct 2019 12:10:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:58844 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2436636AbfJXQKb (ORCPT ); Thu, 24 Oct 2019 12:10:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571933425; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e36bYgYxzu96VpgkIyu2LKZbHdlezcwFd45XXmtDKSI=; b=DvTRy4gkWuC8ctfrEHAKv/ZHn6K+4FWcH2mgs/6cYA+MxiOBH8wHI55peeFvmPMoacoTtm BHW3EigsnNjXd3xSnUy++wZOmSa6WcmKtuWhF0UrbQrUWBMkSoxoiU6k50C4lqNgkdbLsA FehICbKhJdtEGqpr5KwWbl7L8nIzKXY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-2bYyW6FmPjS3LyUzS1ee5w-1; Thu, 24 Oct 2019 12:10:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9DC691005528; Thu, 24 Oct 2019 16:10:10 +0000 (UTC) Received: from [10.36.116.202] (ovpn-116-202.ams2.redhat.com [10.36.116.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id B900117F85; Thu, 24 Oct 2019 16:10:09 +0000 (UTC) Subject: Re: [PATCH v2] mm: gup: fix comment of __get_user_pages() To: Liu Xiang , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, jhubbard@nvidia.com References: <1571929472-3091-1-git-send-email-liuxiang_1999@126.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <0839edc8-c876-1713-c753-f12e70e5a653@redhat.com> Date: Thu, 24 Oct 2019 18:10:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <1571929472-3091-1-git-send-email-liuxiang_1999@126.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 2bYyW6FmPjS3LyUzS1ee5w-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24.10.19 17:04, Liu Xiang wrote: > Fix comment of __get_user_pages() and make it more clear. >=20 > Suggested-by: John Hubbard > Signed-off-by: Liu Xiang > --- >=20 > Changes in v2: > as suggested by John, rewrite the comment about return value. >=20 > mm/gup.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) >=20 > 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 *v= ma, unsigned long gup_flags) > *=09=09Or 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. > * >=20 Reviewed-by: David Hildenbrand --=20 Thanks, David / dhildenb