Messages in this thread Patch in this message | | | From | Chih-En Lin <> | Subject | [PATCH v3 08/14] mm/gup: Break COW PTE in follow_pfn_pte() | Date | Tue, 20 Dec 2022 15:27:37 +0800 |
| |
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@gmail.com> --- 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
| |