struct rb_node **rb_link, *rb_parent;
int retval;
unsigned long charge;
+ MA_STATE(old_mas, &oldmm->mm_mt, 0, 0);
LIST_HEAD(uf);
uprobe_start_dup_mmap();
goto out;
prev = NULL;
- for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) {
+
+ mas_lock(&old_mas);
+ mas_for_each(&old_mas, mpnt, ULONG_MAX) {
struct file *file;
+ if (xa_is_zero(mpnt))
+ continue;
+
+ mas_pause(&old_mas);
+ mas_unlock(&old_mas);
+
if (mpnt->vm_flags & VM_DONTCOPY) {
vm_stat_account(mm, mpnt->vm_flags, -vma_pages(mpnt));
continue;
if (retval)
goto out;
+
+ mas_lock(&old_mas);
}
+ mas_unlock(&old_mas);
+
/* a new mm has just been created */
retval = arch_dup_mmap(oldmm, mm);
out: