Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: don't play games with pinned pages in clear_page_refs

Turning a pinned page read-only breaks the pinning after COW. Don't do it.

The whole "track page soft dirty" state doesn't work with pinned pages
anyway, since the page might be dirtied by the pinning entity without
ever being noticed in the page tables.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+21
+21
fs/proc/task_mmu.c
··· 1035 1035 }; 1036 1036 1037 1037 #ifdef CONFIG_MEM_SOFT_DIRTY 1038 + 1039 + #define is_cow_mapping(flags) (((flags) & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE) 1040 + 1041 + static inline bool pte_is_pinned(struct vm_area_struct *vma, unsigned long addr, pte_t pte) 1042 + { 1043 + struct page *page; 1044 + 1045 + if (!pte_write(pte)) 1046 + return false; 1047 + if (!is_cow_mapping(vma->vm_flags)) 1048 + return false; 1049 + if (likely(!atomic_read(&vma->vm_mm->has_pinned))) 1050 + return false; 1051 + page = vm_normal_page(vma, addr, pte); 1052 + if (!page) 1053 + return false; 1054 + return page_maybe_dma_pinned(page); 1055 + } 1056 + 1038 1057 static inline void clear_soft_dirty(struct vm_area_struct *vma, 1039 1058 unsigned long addr, pte_t *pte) 1040 1059 { ··· 1068 1049 if (pte_present(ptent)) { 1069 1050 pte_t old_pte; 1070 1051 1052 + if (pte_is_pinned(vma, addr, ptent)) 1053 + return; 1071 1054 old_pte = ptep_modify_prot_start(vma, addr, pte); 1072 1055 ptent = pte_wrprotect(old_pte); 1073 1056 ptent = pte_clear_soft_dirty(ptent);