Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9023973ybi; Tue, 23 Jul 2019 20:15:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvOVVi+ADIRpzdDY+W5gpdhg6lfx63PlYIN79kt7bQCJbVDIzzfs6BIqD4GMO5zeKef9oO X-Received: by 2002:a62:cd45:: with SMTP id o66mr9153636pfg.112.1563938119893; Tue, 23 Jul 2019 20:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563938119; cv=none; d=google.com; s=arc-20160816; b=xL2itB9lua7RB6vHr6OzAuePaQnRt1F/Pf1fr9jrT4ggnvrl4ypQr/nutDo0X4OC2b D97xCL36kveEQUcpSyj/yQYRmRKFNcGP+3jvdxMN7w4YMHXbrPzU1WSHSqRhrbrYrBvF 3kNXdLw187Cc+b1J1udrdBj9qIIM6MmNjqxSHbT7y3cRLIEL1ID/8+7ZfqhcJJydPiKa 2NvbZC28I7BmzSrLWieWfI0RcLpxMk8tWe0d63Xd/L4xYnRjY3X65YpeB3pBnhZ3W4Vx KOhLkeGcyoO1o0MwUAKcP0ISB6OQCU+bpdImoQdCMICqTzQsJbFktNGShkzzUdxt6f13 oebQ== 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 :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=vXNCPdLtOKpCMqnhnrWYHHQ4R9DMFg9c7ubyhWGAGSI=; b=wM+hPb/wMEL8k3X+PkeYSCKIh8ltG9x7JcYuFuHgZb8xhf1bEJ9M3ppsHSdMCO5GgR azLicodDVE6WWZdRRx1QcfkcuHbBLgXRPt7w9Ghj/TGPbs6lTvxgVyN9iUcWqsilQLVi Q7e3/bBUhYeAqRzVXAoNos01HSGJSpq2lPSwUVCjtHVP50sxNsgGcTQyyEEBE3jC6QdK 9IADdw4meFYr5w6hjnaqB6pQKMcJ3tW7zmDlFvw0veJbdWJKPiOMXxmeWY329uHgUSWp TsVDHKN7YVtk+eAlKwDhFLipQV9VqeMchvPiPcq0mdKeBhUL5c3Fq9sO77uwR0MRoPgQ v5yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=fM855tyZ; 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 4si13829956pgo.198.2019.07.23.20.15.05; Tue, 23 Jul 2019 20:15:19 -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=fM855tyZ; 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 S1726903AbfGWXa1 (ORCPT + 99 others); Tue, 23 Jul 2019 19:30:27 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:17347 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726768AbfGWXa1 (ORCPT ); Tue, 23 Jul 2019 19:30:27 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 23 Jul 2019 16:30:22 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 23 Jul 2019 16:30:24 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 23 Jul 2019 16:30:24 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 23 Jul 2019 23:30:21 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 23 Jul 2019 23:30:21 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 23 Jul 2019 16:30:21 -0700 From: Ralph Campbell To: CC: , Ralph Campbell , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Jason Gunthorpe , Christoph Hellwig Subject: [PATCH 1/2] mm/hmm: a few more C style and comment clean ups Date: Tue, 23 Jul 2019 16:30:15 -0700 Message-ID: <20190723233016.26403-2-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190723233016.26403-1-rcampbell@nvidia.com> References: <20190723233016.26403-1-rcampbell@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1563924622; bh=vXNCPdLtOKpCMqnhnrWYHHQ4R9DMFg9c7ubyhWGAGSI=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Type:Content-Transfer-Encoding; b=fM855tyZ1WcjIgnyEsZQy7O05+TECy5DrMYAhbx2p36jOb6O5IiErvFCE8Lfi3V8G RLKkR7eVIPK8qwtQXYw9OvS/KqkTsUX7wV7H36PbDzfFgGhMyICZWtaMoJCBxf4mJ/ qtpLJkHil520lNp2U4onHfGqewP3oynUtHuuQWeDqYnGvh+SS9rz2Fc7jEixEHxaY4 Ry9ODubJpC+UqxGV22eGSI8sYEs2SR9kkm5Jc8AaQQYyGVcWcRhT3uN/9Wy8D4pPXz jUsp5ObCYqjuFQMgsIG9zmKwJ8XI9SaD5eRZoEk51lNi5lqTgUkI35WbFckjVjIvZm pb4A5wgPe7U/g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A few more comments and minor programming style clean ups. There should be no functional changes. Signed-off-by: Ralph Campbell Cc: "J=C3=A9r=C3=B4me Glisse" Cc: Jason Gunthorpe Cc: Christoph Hellwig --- mm/hmm.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/mm/hmm.c b/mm/hmm.c index b810a4fa3de9..8271f110c243 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -32,7 +32,7 @@ static const struct mmu_notifier_ops hmm_mmu_notifier_ops= ; * hmm_get_or_create - register HMM against an mm (HMM internal) * * @mm: mm struct to attach to - * Returns: returns an HMM object, either by referencing the existing + * Return: an HMM object, either by referencing the existing * (per-process) object, or by creating a new one. * * This is not intended to be used directly by device drivers. If mm alrea= dy @@ -323,8 +323,8 @@ static int hmm_pfns_bad(unsigned long addr, } =20 /* - * hmm_vma_walk_hole() - handle a range lacking valid pmd or pte(s) - * @start: range virtual start address (inclusive) + * hmm_vma_walk_hole_() - handle a range lacking valid pmd or pte(s) + * @addr: range virtual start address (inclusive) * @end: range virtual end address (exclusive) * @fault: should we fault or not ? * @write_fault: write fault ? @@ -374,9 +374,9 @@ static inline void hmm_pte_need_fault(const struct hmm_= vma_walk *hmm_vma_walk, /* * So we not only consider the individual per page request we also * consider the default flags requested for the range. The API can - * be use in 2 fashions. The first one where the HMM user coalesce - * multiple page fault into one request and set flags per pfns for - * of those faults. The second one where the HMM user want to pre- + * be used 2 ways. The first one where the HMM user coalesces + * multiple page faults into one request and sets flags per pfn for + * those faults. The second one where the HMM user wants to pre- * fault a range with specific flags. For the latter one it is a * waste to have the user pre-fill the pfn arrays with a default * flags value. @@ -386,7 +386,7 @@ static inline void hmm_pte_need_fault(const struct hmm_= vma_walk *hmm_vma_walk, /* We aren't ask to do anything ... */ if (!(pfns & range->flags[HMM_PFN_VALID])) return; - /* If this is device memory than only fault if explicitly requested */ + /* If this is device memory then only fault if explicitly requested */ if ((cpu_flags & range->flags[HMM_PFN_DEVICE_PRIVATE])) { /* Do we fault on device memory ? */ if (pfns & range->flags[HMM_PFN_DEVICE_PRIVATE]) { @@ -500,7 +500,7 @@ static int hmm_vma_handle_pmd(struct mm_walk *walk, hmm_vma_walk->last =3D end; return 0; #else - /* If THP is not enabled then we should never reach that code ! */ + /* If THP is not enabled then we should never reach this code ! */ return -EINVAL; #endif } @@ -624,13 +624,12 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, pte_t *ptep; pmd_t pmd; =20 - again: pmd =3D READ_ONCE(*pmdp); if (pmd_none(pmd)) return hmm_vma_walk_hole(start, end, walk); =20 - if (pmd_huge(pmd) && (range->vma->vm_flags & VM_HUGETLB)) + if (pmd_huge(pmd) && is_vm_hugetlb_page(vma)) return hmm_pfns_bad(start, end, walk); =20 if (thp_migration_supported() && is_pmd_migration_entry(pmd)) { @@ -655,11 +654,11 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, =20 if (pmd_devmap(pmd) || pmd_trans_huge(pmd)) { /* - * No need to take pmd_lock here, even if some other threads + * No need to take pmd_lock here, even if some other thread * is splitting the huge pmd we will get that event through * mmu_notifier callback. * - * So just read pmd value and check again its a transparent + * So just read pmd value and check again it's a transparent * huge or device mapping one and compute corresponding pfn * values. */ @@ -673,7 +672,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, } =20 /* - * We have handled all the valid case above ie either none, migration, + * We have handled all the valid cases above ie either none, migration, * huge or transparent huge. At this point either it is a valid pmd * entry pointing to pte directory or it is a bad pmd that will not * recover. @@ -793,10 +792,10 @@ static int hmm_vma_walk_hugetlb_entry(pte_t *pte, uns= igned long hmask, pte_t entry; int ret =3D 0; =20 - size =3D 1UL << huge_page_shift(h); + size =3D huge_page_size(h); mask =3D size - 1; if (range->page_shift !=3D PAGE_SHIFT) { - /* Make sure we are looking at full page. */ + /* Make sure we are looking at a full page. */ if (start & mask) return -EINVAL; if (end < (start + size)) @@ -807,8 +806,7 @@ static int hmm_vma_walk_hugetlb_entry(pte_t *pte, unsig= ned long hmask, size =3D PAGE_SIZE; } =20 - - ptl =3D huge_pte_lock(hstate_vma(walk->vma), walk->mm, pte); + ptl =3D huge_pte_lock(hstate_vma(vma), walk->mm, pte); entry =3D huge_ptep_get(pte); =20 i =3D (start - range->start) >> range->page_shift; @@ -857,7 +855,7 @@ static void hmm_pfns_clear(struct hmm_range *range, * @start: start virtual address (inclusive) * @end: end virtual address (exclusive) * @page_shift: expect page shift for the range - * Returns 0 on success, -EFAULT if the address space is no longer valid + * Return: 0 on success, -EFAULT if the address space is no longer valid * * Track updates to the CPU page table see include/linux/hmm.h */ --=20 2.20.1