]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: softdirty: clear VM_SOFTDIRTY flag inside clear_refs_write() instead of clear_sof...
authorCyrill Gorcunov <gorcunov@openvz.org>
Thu, 22 May 2014 00:42:44 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:42:44 +0000 (10:42 +1000)
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.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/task_mmu.c

index 4cceb910156fc4930992df591cd80e51a368eca0..fa6d6a4e85b35d6682e9b3a15155b631eb06c03d 100644 (file)
@@ -723,9 +723,6 @@ static inline void clear_soft_dirty(struct vm_area_struct *vma,
                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
 }
@@ -762,11 +759,16 @@ static int clear_refs_test_walk(unsigned long start, unsigned long end,
         * Writing 1 to /proc/pid/clear_refs affects all pages.
         * Writing 2 to /proc/pid/clear_refs only affects anonymous pages.
         * Writing 3 to /proc/pid/clear_refs only affects file mapped pages.
+        * Writing 4 to /proc/pid/clear_refs affects all pages.
         */
        if (cp->type == CLEAR_REFS_ANON && vma->vm_file)
                walk->skip = 1;
        if (cp->type == CLEAR_REFS_MAPPED && !vma->vm_file)
                walk->skip = 1;
+       if (cp->type == CLEAR_REFS_SOFT_DIRTY) {
+               if (vma->vm_flags & VM_SOFTDIRTY)
+                       vma->vm_flags &= ~VM_SOFTDIRTY;
+       }
        return 0;
 }
 
@@ -795,8 +797,9 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
 
        if (type == CLEAR_REFS_SOFT_DIRTY) {
                soft_dirty_cleared = true;
-               pr_warn_once("The pagemap bits 55-60 has changed their meaning! "
-                               "See the linux/Documentation/vm/pagemap.txt for details.\n");
+               pr_warn_once("The pagemap bits 55-60 has changed their meaning!"
+                            " See the linux/Documentation/vm/pagemap.txt for "
+                            "details.\n");
        }
 
        task = get_proc_task(file_inode(file));