int vdso_join_timens(struct task_struct *task, struct time_namespace *ns)
 {
        struct mm_struct *mm = task->mm;
+       VMA_ITERATOR(vmi, mm, 0);
        struct vm_area_struct *vma;
 
        mmap_read_lock(mm);
-       for (vma = mm->mmap; vma; vma = vma->vm_next) {
+       for_each_vma(vmi, vma) {
                unsigned long size = vma->vm_end - vma->vm_start;
 
                if (!vma_is_special_mapping(vma, &vvar_mapping))
 
 static inline void thp_split_mm(struct mm_struct *mm)
 {
        struct vm_area_struct *vma;
+       VMA_ITERATOR(vmi, mm, 0);
 
-       for (vma = mm->mmap; vma != NULL; vma = vma->vm_next) {
+       for_each_vma(vmi, vma) {
                vma->vm_flags &= ~VM_HUGEPAGE;
                vma->vm_flags |= VM_NOHUGEPAGE;
                walk_page_vma(vma, &thp_split_walk_ops, NULL);
        struct mm_struct *mm = current->mm;
        struct vm_area_struct *vma;
        int ret;
+       VMA_ITERATOR(vmi, mm, 0);
 
-       for (vma = mm->mmap; vma; vma = vma->vm_next) {
+       for_each_vma(vmi, vma) {
                ret = ksm_madvise(vma, vma->vm_start, vma->vm_end,
                                  MADV_UNMERGEABLE, &vma->vm_flags);
                if (ret)