diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2017-04-13 17:56:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-21 03:31:19 -0400 |
commit | 5c9d0832022959a8879e082c745281865f5336f0 (patch) | |
tree | 3ee5cdb5e93ba379db3bbef96d8d5583d4a66cd2 /fs | |
parent | f584803c49427ba9623adf93d7078cbe9775b027 (diff) |
thp: fix MADV_DONTNEED vs clear soft dirty race
commit 5b7abeae3af8c08c577e599dd0578b9e3ee6687b upstream.
Yet another instance of the same race.
Fix is identical to change_huge_pmd().
See "thp: fix MADV_DONTNEED vs. numa balancing race" for more details.
Link: http://lkml.kernel.org/r/20170302151034.27829-5-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/task_mmu.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 35b92d81692f..b1517b6dcbdd 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -899,7 +899,14 @@ static inline void clear_soft_dirty(struct vm_area_struct *vma, | |||
899 | static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma, | 899 | static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma, |
900 | unsigned long addr, pmd_t *pmdp) | 900 | unsigned long addr, pmd_t *pmdp) |
901 | { | 901 | { |
902 | pmd_t pmd = pmdp_huge_get_and_clear(vma->vm_mm, addr, pmdp); | 902 | pmd_t pmd = *pmdp; |
903 | |||
904 | /* See comment in change_huge_pmd() */ | ||
905 | pmdp_invalidate(vma, addr, pmdp); | ||
906 | if (pmd_dirty(*pmdp)) | ||
907 | pmd = pmd_mkdirty(pmd); | ||
908 | if (pmd_young(*pmdp)) | ||
909 | pmd = pmd_mkyoung(pmd); | ||
903 | 910 | ||
904 | pmd = pmd_wrprotect(pmd); | 911 | pmd = pmd_wrprotect(pmd); |
905 | pmd = pmd_clear_soft_dirty(pmd); | 912 | pmd = pmd_clear_soft_dirty(pmd); |