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

Commit cb88a76c authored by Suren Baghdasaryan's avatar Suren Baghdasaryan Committed by Srinivasarao Pathipati
Browse files

ANDROID: mm: remove sequence counting when mmap_lock is not exclusively owned



In a number of cases vm_write_{begin|end} is called while mmap_lock is
not owned exclusively. This is unnecessary and can affect correctness of
the sequence counting protecting speculative page fault handlers. Remove
extra calls.

Bug: 257443051
Change-Id: I1278638a0794448e22fbdab5601212b3b2eaebdc
Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
Git-commit: bfdcf47ca34dc3b7b63ca16b0a1856e57c57ee47
Git-repo: https://android.googlesource.com/kernel/common/


[quic_c_spathi@quicinc.com: resolve trivial merge conflicts]
Signed-off-by: default avatarSrinivasarao Pathipati <quic_c_spathi@quicinc.com>
parent 0af50bea
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1553,7 +1553,6 @@ void unmap_page_range(struct mmu_gather *tlb,
	unsigned long next;

	BUG_ON(addr >= end);
	vm_write_begin(vma);
	tlb_start_vma(tlb, vma);
	pgd = pgd_offset(vma->vm_mm, addr);
	do {
@@ -1563,7 +1562,6 @@ void unmap_page_range(struct mmu_gather *tlb,
		next = zap_p4d_range(tlb, vma, pgd, addr, next, details);
	} while (pgd++, addr = next, addr != end);
	tlb_end_vma(tlb, vma);
	vm_write_end(vma);
}


+0 −2
Original line number Diff line number Diff line
@@ -599,11 +599,9 @@ unsigned long change_prot_numa(struct vm_area_struct *vma,
{
	int nr_updated;

	vm_write_begin(vma);
	nr_updated = change_protection(vma, addr, end, PAGE_NONE, 0, 1);
	if (nr_updated)
		count_vm_numa_events(NUMA_PTE_UPDATES, nr_updated);
	vm_write_end(vma);

	return nr_updated;
}