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

Commit b48ec80b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mm: flush TLB once pages are copied when SPF is on"

parents 0cf6e3ee 48040c3f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -934,6 +934,7 @@ static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
	spinlock_t *src_ptl, *dst_ptl;
	int progress = 0;
	int rss[NR_MM_COUNTERS];
	unsigned long orig_addr = addr;
	swp_entry_t entry = (swp_entry_t){0};

again:
@@ -972,6 +973,15 @@ static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
	} while (dst_pte++, src_pte++, addr += PAGE_SIZE, addr != end);

	arch_leave_lazy_mmu_mode();

	/*
	 * Prevent the page fault handler to copy the page while stale tlb entry
	 * are still not flushed.
	 */
	if (IS_ENABLED(CONFIG_SPECULATIVE_PAGE_FAULT) &&
	    is_cow_mapping(vma->vm_flags))
		flush_tlb_range(vma, orig_addr, end);

	spin_unlock(src_ptl);
	pte_unmap(orig_src_pte);
	add_mm_rss_vec(dst_mm, rss);