Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm64: mm: factor out the address and ptep alignment into a new helper

Factor out the contpte block's address and ptep alignment into a new
helper, and will be reused in the following patch.

No functional changes.

Link: https://lkml.kernel.org/r/8076d12cb244b2d9e91119b44dc6d5e4ad9c00af.1770645603.git.baolin.wang@linux.alibaba.com
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Harry Yoo <harry.yoo@oracle.com>
Cc: Jann Horn <jannh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Baolin Wang and committed by
Andrew Morton
67d59bdd 52e054f7

+21 -8
+21 -8
arch/arm64/mm/contpte.c
··· 26 26 return PTR_ALIGN_DOWN(ptep, sizeof(*ptep) * CONT_PTES); 27 27 } 28 28 29 + static inline pte_t *contpte_align_addr_ptep(unsigned long *start, 30 + unsigned long *end, pte_t *ptep, 31 + unsigned int nr) 32 + { 33 + /* 34 + * Note: caller must ensure these nr PTEs are consecutive (present) 35 + * PTEs that map consecutive pages of the same large folio within a 36 + * single VMA and a single page table. 37 + */ 38 + if (pte_cont(__ptep_get(ptep + nr - 1))) 39 + *end = ALIGN(*end, CONT_PTE_SIZE); 40 + 41 + if (pte_cont(__ptep_get(ptep))) { 42 + *start = ALIGN_DOWN(*start, CONT_PTE_SIZE); 43 + ptep = contpte_align_down(ptep); 44 + } 45 + 46 + return ptep; 47 + } 48 + 29 49 static void contpte_try_unfold_partial(struct mm_struct *mm, unsigned long addr, 30 50 pte_t *ptep, unsigned int nr) 31 51 { ··· 589 569 unsigned long start = addr; 590 570 unsigned long end = start + nr * PAGE_SIZE; 591 571 592 - if (pte_cont(__ptep_get(ptep + nr - 1))) 593 - end = ALIGN(end, CONT_PTE_SIZE); 594 - 595 - if (pte_cont(__ptep_get(ptep))) { 596 - start = ALIGN_DOWN(start, CONT_PTE_SIZE); 597 - ptep = contpte_align_down(ptep); 598 - } 599 - 572 + ptep = contpte_align_addr_ptep(&start, &end, ptep, nr); 600 573 __clear_young_dirty_ptes(vma, start, ptep, (end - start) / PAGE_SIZE, flags); 601 574 } 602 575 EXPORT_SYMBOL_GPL(contpte_clear_young_dirty_ptes);