The clear_refs_write is called earlier than clear_soft_dirty and it is
more natural to clear VM_SOFTDIRTY (which belongs to VMA entry but not
PTEs) that early instead of clearing it a way deeper inside call chain.

CC: Pavel Emelyanov <[email protected]>
CC: Andrew Morton <[email protected]>
Signed-off-by: Cyrill Gorcunov <[email protected]>
---
 fs/proc/task_mmu.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: linux-2.6.git/fs/proc/task_mmu.c
===================================================================
--- linux-2.6.git.orig/fs/proc/task_mmu.c
+++ linux-2.6.git/fs/proc/task_mmu.c
@@ -736,9 +736,6 @@ static inline void clear_soft_dirty(stru
                ptent = pte_file_clear_soft_dirty(ptent);
        }
 
-       if (vma->vm_flags & VM_SOFTDIRTY)
-               vma->vm_flags &= ~VM_SOFTDIRTY;
-
        set_pte_at(vma->vm_mm, addr, pte, ptent);
 #endif
 }
@@ -843,6 +840,10 @@ static ssize_t clear_refs_write(struct f
                                continue;
                        if (type == CLEAR_REFS_MAPPED && !vma->vm_file)
                                continue;
+                       if (type == CLEAR_REFS_SOFT_DIRTY) {
+                               if (vma->vm_flags & VM_SOFTDIRTY)
+                                       vma->vm_flags &= ~VM_SOFTDIRTY;
+                       }
                        walk_page_range(vma->vm_start, vma->vm_end,
                                        &clear_refs_walk);
                }

--
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/

Reply via email to