Replace use of the legacy vm_flags_t flags with vma_flags_t values where KSM tests VMA flags directly. The ksm_madvise() interface continues to take legacy flags for the time being. No functional change intended. Signed-off-by: Lorenzo Stoakes (ARM) --- mm/ksm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index d6f736a1aa2f..61b772bba229 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -779,7 +779,7 @@ static struct vm_area_struct *find_mergeable_vma(struct mm_struct *mm, if (ksm_test_exit(mm)) return NULL; vma = vma_lookup(mm, addr); - if (!vma || !(vma->vm_flags & VM_MERGEABLE) || !vma_has_anon_rmap(vma)) + if (!vma || !vma_test(vma, VMA_MERGEABLE_BIT) || !vma_has_anon_rmap(vma)) return NULL; return vma; } @@ -1243,7 +1243,8 @@ static int unmerge_and_remove_all_rmap_items(void) goto mm_exiting; for_each_vma(vmi, vma) { - if (!(vma->vm_flags & VM_MERGEABLE) || !vma_has_anon_rmap(vma)) + if (!vma_test(vma, VMA_MERGEABLE_BIT) || + !vma_has_anon_rmap(vma)) continue; err = break_ksm(vma, vma->vm_start, vma->vm_end, false); if (err) @@ -2698,7 +2699,7 @@ static struct ksm_rmap_item *scan_get_next_rmap_item(struct page **page) goto no_vmas; for_each_vma(vmi, vma) { - if (!(vma->vm_flags & VM_MERGEABLE)) + if (!vma_test(vma, VMA_MERGEABLE_BIT)) continue; if (ksm_scan.address < vma->vm_start) ksm_scan.address = vma->vm_start; @@ -2890,7 +2891,7 @@ static int __ksm_del_vma(struct vm_area_struct *vma) { int err; - if (!(vma->vm_flags & VM_MERGEABLE)) + if (!vma_test(vma, VMA_MERGEABLE_BIT)) return 0; if (vma_has_anon_rmap(vma)) { @@ -3027,7 +3028,7 @@ int ksm_madvise(struct vm_area_struct *vma, unsigned long start, switch (advice) { case MADV_MERGEABLE: - if (vma->vm_flags & VM_MERGEABLE) + if (vma_test(vma, VMA_MERGEABLE_BIT)) return 0; if (!vma_ksm_compatible(vma)) return 0; @@ -3484,7 +3485,7 @@ bool ksm_process_mergeable(struct mm_struct *mm) mmap_assert_locked(mm); VMA_ITERATOR(vmi, mm, 0); for_each_vma(vmi, vma) - if (vma->vm_flags & VM_MERGEABLE) + if (vma_test(vma, VMA_MERGEABLE_BIT)) return true; return false; -- 2.56.0