Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp153479imp; Wed, 20 Feb 2019 16:30:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IYT0sLWvm4AJ1so0wWeXp6isjVzyZDDSdXYITgqDz8+oszgPK4alrPR+2nYQdfwXIF+WQXO X-Received: by 2002:a63:5a42:: with SMTP id k2mr17989708pgm.333.1550709005714; Wed, 20 Feb 2019 16:30:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550709005; cv=none; d=google.com; s=arc-20160816; b=UwNPLQoFPzQyBAsdohEbicQHta/UyGM3POlRUrKEAa54VRQpX7uV6wu/uTTvFUj+D7 dCjCYxja6UBTWNgievO6b9TUIobf5K1MYgSfGrnf196mK01eUQaVi2CbAKRFA3lpoId+ Z6KhdTXgEawqi+2CVlhFhQMP+M+sRYLKiEN0LuDwUuCYAWgZm3hjpBrisobHIO1gCF28 CYHSplKlxKqqsGD2Xrk7M+tsk9e7yi3UDJsJimWxRnv4r38nD0K6nGtRmc5GLks+E/Gn /XnTLROLlvgUr8NWyO5rM4IufiBdoA6JbC+TIYvFMAKP5oIO/spxTL1LXra5qC7kIDFM ZV1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=vjyTOL7J4ZDxE6m9GwW8s41cXxahZLQgd3j9HhKCaeA=; b=me3QQlkOpPXgrFiIUPcKp1o9WkPZAd0AkycMLOlcUAaJU+EVPVE+R7xdgYuOwRH8eq xT35B3oasaWX763nQkXGdBfrdmCMjpWccSgh1pvvl9ODVMLPDSnlBZ4ABrlgJZGWO19h d9E22a5GsFYJ6ldEXCclmCEFweYiOXX/vYx1tsyR6Wtc2lDwR6XndTY99xpzS1bR5DSw FhUY9QYsWhnxcaYbRB29o22HzmNz7r+TxhhCgovK0od0VeTB6JttsTnfao2QZxoQSxVD 8xbKmlDYIAxZ9yqx5Ww2DcRo0avpA/Y/FCj5W3wHcEt+TlzK23wAhojI1durGhRw+NRP 3oTQ== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si4730727pgv.53.2019.02.20.16.29.49; Wed, 20 Feb 2019 16:30:05 -0800 (PST) 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726420AbfBUA2N (ORCPT + 99 others); Wed, 20 Feb 2019 19:28:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47876 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726016AbfBUA2M (ORCPT ); Wed, 20 Feb 2019 19:28:12 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A0594E916; Thu, 21 Feb 2019 00:28:12 +0000 (UTC) Received: from redhat.com (ovpn-120-249.rdu2.redhat.com [10.10.120.249]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE2E61001DC8; Thu, 21 Feb 2019 00:28:11 +0000 (UTC) Date: Wed, 20 Feb 2019 19:28:09 -0500 From: Jerome Glisse To: John Hubbard Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Ralph Campbell Subject: Re: [PATCH 03/10] mm/hmm: improve and rename hmm_vma_get_pfns() to hmm_range_snapshot() Message-ID: <20190221002809.GC24489@redhat.com> References: <20190129165428.3931-1-jglisse@redhat.com> <20190129165428.3931-4-jglisse@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 21 Feb 2019 00:28:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 20, 2019 at 04:25:07PM -0800, John Hubbard wrote: > On 1/29/19 8:54 AM, jglisse@redhat.com wrote: > > From: J?r?me Glisse > > > > Rename for consistency between code, comments and documentation. Also > > improves the comments on all the possible returns values. Improve the > > function by returning the number of populated entries in pfns array. > > > > Signed-off-by: J?r?me Glisse > > Cc: Andrew Morton > > Cc: Ralph Campbell > > Cc: John Hubbard > > --- > > include/linux/hmm.h | 4 ++-- > > mm/hmm.c | 23 ++++++++++------------- > > 2 files changed, 12 insertions(+), 15 deletions(-) > > > > Hi Jerome, > > After applying the entire patchset, I still see a few hits of the old name, > in Documentation: > > $ git grep -n hmm_vma_get_pfns > Documentation/vm/hmm.rst:192: int hmm_vma_get_pfns(struct vm_area_struct *vma, > Documentation/vm/hmm.rst:205:The first one (hmm_vma_get_pfns()) will only > fetch present CPU page table > Documentation/vm/hmm.rst:224: ret = hmm_vma_get_pfns(vma, &range, > start, end, pfns); > include/linux/hmm.h:145: * HMM pfn value returned by hmm_vma_get_pfns() or > hmm_vma_fault() will be: > > > > diff --git a/include/linux/hmm.h b/include/linux/hmm.h > > index bd6e058597a6..ddf49c1b1f5e 100644 > > --- a/include/linux/hmm.h > > +++ b/include/linux/hmm.h > > @@ -365,11 +365,11 @@ void hmm_mirror_unregister(struct hmm_mirror *mirror); > > * table invalidation serializes on it. > > * > > * YOU MUST CALL hmm_vma_range_done() ONCE AND ONLY ONCE EACH TIME YOU CALL > > - * hmm_vma_get_pfns() WITHOUT ERROR ! > > + * hmm_range_snapshot() WITHOUT ERROR ! > > * > > * IF YOU DO NOT FOLLOW THE ABOVE RULE THE SNAPSHOT CONTENT MIGHT BE INVALID ! > > */ > > -int hmm_vma_get_pfns(struct hmm_range *range); > > +long hmm_range_snapshot(struct hmm_range *range); > > bool hmm_vma_range_done(struct hmm_range *range); > > diff --git a/mm/hmm.c b/mm/hmm.c > > index 74d69812d6be..0d9ecd3337e5 100644 > > --- a/mm/hmm.c > > +++ b/mm/hmm.c > > @@ -706,23 +706,19 @@ static void hmm_pfns_special(struct hmm_range *range) > > } > > /* > > - * hmm_vma_get_pfns() - snapshot CPU page table for a range of virtual addresses > > - * @range: range being snapshotted > > + * hmm_range_snapshot() - snapshot CPU page table for a range > > + * @range: range > > * Returns: -EINVAL if invalid argument, -ENOMEM out of memory, -EPERM invalid > > Channeling Mike Rapoport, that should be @Return: instead of Returns: , but... > > > > - * vma permission, 0 success > > + * permission (for instance asking for write and range is read only), > > + * -EAGAIN if you need to retry, -EFAULT invalid (ie either no valid > > + * vma or it is illegal to access that range), number of valid pages > > + * in range->pfns[] (from range start address). > > ...actually, that's a little hard to spot that we're returning number of > valid pages. How about: > > * @Returns: number of valid pages in range->pfns[] (from range start > * address). This may be zero. If the return value is negative, > * then one of the following values may be returned: > * > * -EINVAL range->invalid is set, or range->start or range->end > * are not valid. > * -EPERM For example, asking for write, when the range is > * read-only > * -EAGAIN Caller needs to retry > * -EFAULT Either no valid vma exists for this range, or it is > * illegal to access the range > > (caution: my white space might be wrong with respect to tabs) Will do a documentation patch to improve things and remove leftover. Cheers, J?r?me