Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 18284769 authored by Alexander Winkowski's avatar Alexander Winkowski
Browse files

Revert "BACKPORT: FROMLIST: mm: protect free_pgtables with mmap_lock write lock in exit_mmap"



This reverts commit bb3bc96f.

Change-Id: Id31ad7085d20706bbc6dc12a05b7c1e31b3edc2a
Signed-off-by: default avatarAlexander Winkowski <dereference23@outlook.com>
parent 4a527b37
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -3259,9 +3259,10 @@ void exit_mmap(struct mm_struct *mm)
		(void)__oom_reap_task_mm(mm);

		set_bit(MMF_OOM_SKIP, &mm->flags);
		down_write(&mm->mmap_sem);
		up_write(&mm->mmap_sem);
	}

	down_write(&mm->mmap_sem);
	if (mm->locked_vm) {
		vma = mm->mmap;
		while (vma) {
@@ -3274,11 +3275,8 @@ void exit_mmap(struct mm_struct *mm)
	arch_exit_mmap(mm);

	vma = mm->mmap;
	if (!vma) {
		/* Can happen if dup_mmap() received an OOM */
		up_write(&mm->mmap_sem);;
	if (!vma)	/* Can happen if dup_mmap() received an OOM */
		return;
	}

	lru_add_drain();
	flush_cache_mm(mm);
@@ -3289,14 +3287,16 @@ void exit_mmap(struct mm_struct *mm)
	free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, USER_PGTABLES_CEILING);
	tlb_finish_mmu(&tlb, 0, -1);

	/* Walk the list again, actually closing and freeing it. */
	/*
	 * Walk the list again, actually closing and freeing it,
	 * with preemption enabled, without holding any MM locks.
	 */
	while (vma) {
		if (vma->vm_flags & VM_ACCOUNT)
			nr_accounted += vma_pages(vma);
		vma = remove_vma(vma);
		cond_resched();
	}
	up_write(&mm->mmap_sem);
	vm_unacct_memory(nr_accounted);
}