mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 13:44:15 +08:00
thp: fix MADV_DONTNEED vs clear soft dirty race
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> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
58ceeb6bec
commit
5b7abeae3a
@ -900,7 +900,14 @@ static inline void clear_soft_dirty(struct vm_area_struct *vma,
|
|||||||
static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
|
static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
|
||||||
unsigned long addr, pmd_t *pmdp)
|
unsigned long addr, pmd_t *pmdp)
|
||||||
{
|
{
|
||||||
pmd_t pmd = pmdp_huge_get_and_clear(vma->vm_mm, addr, pmdp);
|
pmd_t pmd = *pmdp;
|
||||||
|
|
||||||
|
/* See comment in change_huge_pmd() */
|
||||||
|
pmdp_invalidate(vma, addr, pmdp);
|
||||||
|
if (pmd_dirty(*pmdp))
|
||||||
|
pmd = pmd_mkdirty(pmd);
|
||||||
|
if (pmd_young(*pmdp))
|
||||||
|
pmd = pmd_mkyoung(pmd);
|
||||||
|
|
||||||
pmd = pmd_wrprotect(pmd);
|
pmd = pmd_wrprotect(pmd);
|
||||||
pmd = pmd_clear_soft_dirty(pmd);
|
pmd = pmd_clear_soft_dirty(pmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user