[PATCH v3 08/14] mm/gup: Break COW PTE in follow_pfn_pte()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In most of cases, GUP will not modify the page table,
excluding follow_pfn_pte(). To deal with COW PTE, break
COW PTE in follow_pfn_pte().

Signed-off-by: Chih-En Lin <shiyn.lin@xxxxxxxxx>
---
 mm/gup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/gup.c b/mm/gup.c
index fe195d47de74a..cd72010ba0e6d 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -476,6 +476,8 @@ static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address,
 		entry = pte_mkyoung(entry);
 
 		if (!pte_same(*pte, entry)) {
+			if (break_cow_pte(vma, NULL, address) < 0)
+				return -ENOMEM;
 			set_pte_at(vma->vm_mm, address, pte, entry);
 			update_mmu_cache(vma, address, pte);
 		}
-- 
2.37.3





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux