i386 mm: use pte_update() in ptep_test_and_clear_dirty()
It is not safe to use pte_update_defer() in ptep_test_and_clear_young(): its only user, /proc/<pid>/clear_refs, drops pte lock before flushing TLB. Use the safe though less efficient pte_update() paravirtop in its place. Likewise in ptep_test_and_clear_dirty(), though that has no current use. These are macros (header file dependency stops them from becoming inline functions), so be more liberal with the underscores and parentheses. Signed-off-by: Hugh Dickins <hugh@veritas.com> Cc: Zachary Amsden <zach@vmware.com> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Родитель
30475cc12a
Коммит
d6f8bb1310
|
@ -295,22 +295,24 @@ do { \
|
||||||
|
|
||||||
#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
|
#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
|
||||||
#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \
|
#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \
|
||||||
int ret = 0; \
|
int __ret = 0; \
|
||||||
if (pte_dirty(*ptep)) \
|
if (pte_dirty(*(ptep))) \
|
||||||
ret = test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); \
|
__ret = test_and_clear_bit(_PAGE_BIT_DIRTY, \
|
||||||
if (ret) \
|
&(ptep)->pte_low); \
|
||||||
pte_update_defer(vma->vm_mm, addr, ptep); \
|
if (__ret) \
|
||||||
ret; \
|
pte_update((vma)->vm_mm, addr, ptep); \
|
||||||
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
|
#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
|
||||||
#define ptep_test_and_clear_young(vma, addr, ptep) ({ \
|
#define ptep_test_and_clear_young(vma, addr, ptep) ({ \
|
||||||
int ret = 0; \
|
int __ret = 0; \
|
||||||
if (pte_young(*ptep)) \
|
if (pte_young(*(ptep))) \
|
||||||
ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); \
|
__ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, \
|
||||||
if (ret) \
|
&(ptep)->pte_low); \
|
||||||
pte_update_defer(vma->vm_mm, addr, ptep); \
|
if (__ret) \
|
||||||
ret; \
|
pte_update((vma)->vm_mm, addr, ptep); \
|
||||||
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче