lkml.org 
[lkml]   [2022]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 08/14] mm/gup: Break COW PTE in follow_pfn_pte()
Date
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
\
 
 \ /
  Last update: 2023-03-26 23:15    [W:0.102 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site