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.

mm: change to return bool for pmdp_test_and_clear_young()

Callers use pmdp_test_and_clear_young() to clear the young flag and check
whether it was set for this PMD entry. Change the return type to bool to
make the intention clearer.

Link: https://lkml.kernel.org/r/f1d31307a13365d3d0fed5809727dcc2dd59631b.1774075004.git.baolin.wang@linux.alibaba.com
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Baolin Wang and committed by
Andrew Morton
42e26354 06c4dfa3

+27 -29
+2 -3
arch/arm64/include/asm/pgtable.h
··· 1320 1320 1321 1321 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG) 1322 1322 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG 1323 - static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma, 1324 - unsigned long address, 1325 - pmd_t *pmdp) 1323 + static inline bool pmdp_test_and_clear_young(struct vm_area_struct *vma, 1324 + unsigned long address, pmd_t *pmdp) 1326 1325 { 1327 1326 /* Operation applies to PMD table entry only if FEAT_HAFT is enabled */ 1328 1327 VM_WARN_ON(pmd_table(READ_ONCE(*pmdp)) && !system_supports_haft());
+5 -5
arch/powerpc/include/asm/book3s/64/pgtable.h
··· 1161 1161 * For radix we should always find H_PAGE_HASHPTE zero. Hence 1162 1162 * the below will work for radix too 1163 1163 */ 1164 - static inline int __pmdp_test_and_clear_young(struct mm_struct *mm, 1165 - unsigned long addr, pmd_t *pmdp) 1164 + static inline bool __pmdp_test_and_clear_young(struct mm_struct *mm, 1165 + unsigned long addr, pmd_t *pmdp) 1166 1166 { 1167 1167 unsigned long old; 1168 1168 1169 1169 if ((pmd_raw(*pmdp) & cpu_to_be64(_PAGE_ACCESSED | H_PAGE_HASHPTE)) == 0) 1170 - return 0; 1170 + return false; 1171 1171 old = pmd_hugepage_update(mm, addr, pmdp, _PAGE_ACCESSED, 0); 1172 1172 return ((old & _PAGE_ACCESSED) != 0); 1173 1173 } ··· 1300 1300 pud_t entry, int dirty); 1301 1301 1302 1302 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG 1303 - extern int pmdp_test_and_clear_young(struct vm_area_struct *vma, 1304 - unsigned long address, pmd_t *pmdp); 1303 + bool pmdp_test_and_clear_young(struct vm_area_struct *vma, 1304 + unsigned long address, pmd_t *pmdp); 1305 1305 #define __HAVE_ARCH_PUDP_TEST_AND_CLEAR_YOUNG 1306 1306 extern int pudp_test_and_clear_young(struct vm_area_struct *vma, 1307 1307 unsigned long address, pud_t *pudp);
+2 -2
arch/powerpc/mm/book3s64/pgtable.c
··· 98 98 } 99 99 100 100 101 - int pmdp_test_and_clear_young(struct vm_area_struct *vma, 102 - unsigned long address, pmd_t *pmdp) 101 + bool pmdp_test_and_clear_young(struct vm_area_struct *vma, 102 + unsigned long address, pmd_t *pmdp) 103 103 { 104 104 return __pmdp_test_and_clear_young(vma->vm_mm, address, pmdp); 105 105 }
+2 -2
arch/riscv/include/asm/pgtable.h
··· 1015 1015 } 1016 1016 1017 1017 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG 1018 - static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma, 1019 - unsigned long address, pmd_t *pmdp) 1018 + static inline bool pmdp_test_and_clear_young(struct vm_area_struct *vma, 1019 + unsigned long address, pmd_t *pmdp) 1020 1020 { 1021 1021 return ptep_test_and_clear_young(vma, address, (pte_t *)pmdp); 1022 1022 }
+2 -2
arch/s390/include/asm/pgtable.h
··· 1683 1683 } 1684 1684 1685 1685 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG 1686 - static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma, 1687 - unsigned long addr, pmd_t *pmdp) 1686 + static inline bool pmdp_test_and_clear_young(struct vm_area_struct *vma, 1687 + unsigned long addr, pmd_t *pmdp) 1688 1688 { 1689 1689 pmd_t pmd = *pmdp; 1690 1690
+2 -2
arch/x86/include/asm/pgtable.h
··· 1295 1295 pud_t entry, int dirty); 1296 1296 1297 1297 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG 1298 - extern int pmdp_test_and_clear_young(struct vm_area_struct *vma, 1299 - unsigned long addr, pmd_t *pmdp); 1298 + bool pmdp_test_and_clear_young(struct vm_area_struct *vma, 1299 + unsigned long addr, pmd_t *pmdp); 1300 1300 extern int pudp_test_and_clear_young(struct vm_area_struct *vma, 1301 1301 unsigned long addr, pud_t *pudp); 1302 1302
+3 -3
arch/x86/mm/pgtable.c
··· 456 456 } 457 457 458 458 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG) 459 - int pmdp_test_and_clear_young(struct vm_area_struct *vma, 460 - unsigned long addr, pmd_t *pmdp) 459 + bool pmdp_test_and_clear_young(struct vm_area_struct *vma, 460 + unsigned long addr, pmd_t *pmdp) 461 461 { 462 - int ret = 0; 462 + bool ret = false; 463 463 464 464 if (pmd_young(*pmdp)) 465 465 ret = test_and_clear_bit(_PAGE_BIT_ACCESSED,
+9 -10
include/linux/pgtable.h
··· 507 507 508 508 #ifndef __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG 509 509 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG) 510 - static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma, 511 - unsigned long address, 512 - pmd_t *pmdp) 510 + static inline bool pmdp_test_and_clear_young(struct vm_area_struct *vma, 511 + unsigned long address, pmd_t *pmdp) 513 512 { 514 513 pmd_t pmd = *pmdp; 515 - int r = 1; 514 + bool young = true; 515 + 516 516 if (!pmd_young(pmd)) 517 - r = 0; 517 + young = false; 518 518 else 519 519 set_pmd_at(vma->vm_mm, address, pmdp, pmd_mkold(pmd)); 520 - return r; 520 + return young; 521 521 } 522 522 #else 523 - static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma, 524 - unsigned long address, 525 - pmd_t *pmdp) 523 + static inline bool pmdp_test_and_clear_young(struct vm_area_struct *vma, 524 + unsigned long address, pmd_t *pmdp) 526 525 { 527 526 BUILD_BUG(); 528 - return 0; 527 + return false; 529 528 } 530 529 #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG */ 531 530 #endif