Skip to contentSkip to conversation

mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd()

PATCH In review Oleg Nesterov 4 participants 4 messages Dec 16, 2015 – Dec 22, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd()

clear_soft_dirty_pmd() is called by clear_refs_write(CLEAR_REFS_SOFT_DIRTY), VM_SOFTDIRTY was already cleared before walk_page_range().

---
 fs/proc/task_mmu.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/proc/task_mmu.c +0 -3
index 187b3b5..1a02b15 100644
@@ -817,9 +817,6 @@ static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
 	pmd = pmd_wrprotect(pmd);
 	pmd = pmd_clear_soft_dirty(pmd);
 
-	if (vma->vm_flags & VM_SOFTDIRTY)
-		vma->vm_flags &= ~VM_SOFTDIRTY;
-
 	set_pmd_at(vma->vm_mm, addr, pmdp, pmd);
 }
 #else
Signature · 1 line
1.5.5.1
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Oleg Nesterov

clear_soft_dirty_pmd() is called by clear_refs_write(CLEAR_REFS_SOFT_DIRTY), VM_SOFTDIRTY was already cleared before walk_page_range().

Not only that, We shouldn't [generally] change vm_flags without exclusive mmap_sem and we have only down_read() here.

Quoted 1 line
Quoted 27 lines
---
 fs/proc/task_mmu.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/proc/task_mmu.c +0 -3
index 187b3b5..1a02b15 100644
@@ -817,9 +817,6 @@ static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
 	pmd = pmd_wrprotect(pmd);
 	pmd = pmd_clear_soft_dirty(pmd);
 
-	if (vma->vm_flags & VM_SOFTDIRTY)
-		vma->vm_flags &= ~VM_SOFTDIRTY;
-
 	set_pmd_at(vma->vm_mm, addr, pmdp, pmd);
 }
 #else
Signature · 8 lines
1.5.5.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 1 line
 Kirill A. Shutemov