diff options
author | Cyrill Gorcunov <gorcunov@openvz.org> | 2014-06-04 19:06:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-04 19:53:56 -0400 |
commit | c86c97ff42cd6c6d1bd29eca4dfabeaf2b7f1020 (patch) | |
tree | 2114b5deab734d4d8f62b612910f62f29e696a33 /fs/proc | |
parent | b43790eedd31e9535b89bbfa45793919e9504c34 (diff) |
mm: softdirty: clear VM_SOFTDIRTY flag inside clear_refs_write() instead of clear_soft_dirty()
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/task_mmu.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 442177b1119a..2101ce46a5d2 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -737,9 +737,6 @@ static inline void clear_soft_dirty(struct vm_area_struct *vma, | |||
737 | ptent = pte_file_clear_soft_dirty(ptent); | 737 | ptent = pte_file_clear_soft_dirty(ptent); |
738 | } | 738 | } |
739 | 739 | ||
740 | if (vma->vm_flags & VM_SOFTDIRTY) | ||
741 | vma->vm_flags &= ~VM_SOFTDIRTY; | ||
742 | |||
743 | set_pte_at(vma->vm_mm, addr, pte, ptent); | 740 | set_pte_at(vma->vm_mm, addr, pte, ptent); |
744 | #endif | 741 | #endif |
745 | } | 742 | } |
@@ -807,8 +804,9 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, | |||
807 | 804 | ||
808 | if (type == CLEAR_REFS_SOFT_DIRTY) { | 805 | if (type == CLEAR_REFS_SOFT_DIRTY) { |
809 | soft_dirty_cleared = true; | 806 | soft_dirty_cleared = true; |
810 | pr_warn_once("The pagemap bits 55-60 has changed their meaning! " | 807 | pr_warn_once("The pagemap bits 55-60 has changed their meaning!" |
811 | "See the linux/Documentation/vm/pagemap.txt for details.\n"); | 808 | " See the linux/Documentation/vm/pagemap.txt for " |
809 | "details.\n"); | ||
812 | } | 810 | } |
813 | 811 | ||
814 | task = get_proc_task(file_inode(file)); | 812 | task = get_proc_task(file_inode(file)); |
@@ -839,11 +837,17 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, | |||
839 | * | 837 | * |
840 | * Writing 3 to /proc/pid/clear_refs only affects file | 838 | * Writing 3 to /proc/pid/clear_refs only affects file |
841 | * mapped pages. | 839 | * mapped pages. |
840 | * | ||
841 | * Writing 4 to /proc/pid/clear_refs affects all pages. | ||
842 | */ | 842 | */ |
843 | if (type == CLEAR_REFS_ANON && vma->vm_file) | 843 | if (type == CLEAR_REFS_ANON && vma->vm_file) |
844 | continue; | 844 | continue; |
845 | if (type == CLEAR_REFS_MAPPED && !vma->vm_file) | 845 | if (type == CLEAR_REFS_MAPPED && !vma->vm_file) |
846 | continue; | 846 | continue; |
847 | if (type == CLEAR_REFS_SOFT_DIRTY) { | ||
848 | if (vma->vm_flags & VM_SOFTDIRTY) | ||
849 | vma->vm_flags &= ~VM_SOFTDIRTY; | ||
850 | } | ||
847 | walk_page_range(vma->vm_start, vma->vm_end, | 851 | walk_page_range(vma->vm_start, vma->vm_end, |
848 | &clear_refs_walk); | 852 | &clear_refs_walk); |
849 | } | 853 | } |