Message ID | 20220628092235.91270-9-songmuchun@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Simplify hugetlb vmemmap and improve its readability | expand |
On 06/28/22 17:22, Muchun Song wrote: > There is already a macro PTRS_PER_PTE to represent the number of page table > entries, just use it. > > Signed-off-by: Muchun Song <songmuchun@bytedance.com> > --- > mm/hugetlb_vmemmap.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c > index 6bbc445b1a66..65b527e1799c 100644 > --- a/mm/hugetlb_vmemmap.c > +++ b/mm/hugetlb_vmemmap.c > @@ -48,7 +48,7 @@ static int __split_vmemmap_huge_pmd(pmd_t *pmd, unsigned long start) > > pmd_populate_kernel(&init_mm, &__pmd, pgtable); > > - for (i = 0; i < PMD_SIZE / PAGE_SIZE; i++, addr += PAGE_SIZE) { > + for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) { > pte_t entry, *pte; > pgprot_t pgprot = PAGE_KERNEL; > > -- > 2.11.0 > That certainly seems like right macro/value to use. Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index 6bbc445b1a66..65b527e1799c 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -48,7 +48,7 @@ static int __split_vmemmap_huge_pmd(pmd_t *pmd, unsigned long start) pmd_populate_kernel(&init_mm, &__pmd, pgtable); - for (i = 0; i < PMD_SIZE / PAGE_SIZE; i++, addr += PAGE_SIZE) { + for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) { pte_t entry, *pte; pgprot_t pgprot = PAGE_KERNEL;
There is already a macro PTRS_PER_PTE to represent the number of page table entries, just use it. Signed-off-by: Muchun Song <songmuchun@bytedance.com> --- mm/hugetlb_vmemmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)