From: Andrew Morton Cc: David Rientjes Cc: Hugh Dickins Cc: Zachary Amsden Signed-off-by: Andrew Morton --- include/asm-i386/pgtable.h | 36 +++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff -puN include/asm-i386/pgtable.h~i386-use-pte_update_defer-in-ptep_test_and_clear_dirtyyoung-fix include/asm-i386/pgtable.h --- a/include/asm-i386/pgtable.h~i386-use-pte_update_defer-in-ptep_test_and_clear_dirtyyoung-fix +++ a/include/asm-i386/pgtable.h @@ -284,28 +284,24 @@ do { \ } while (0) #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY -static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep) -{ - int ret = 0; - if (pte_dirty(*ptep)) - ret = test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); - if (ret) - pte_update_defer(vma->vm_mm, addr, ptep); - return ret; -} +#define ptep_test_and_clear_dirty(vma, addr, ptep) ({ \ + int ret = 0; \ + if (pte_dirty(*ptep)) \ + ret = test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); \ + if (ret) \ + pte_update_defer(vma->vm_mm, addr, ptep); \ + ret; \ +}) #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG -static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep) -{ - int ret = 0; - if (pte_young(*ptep)) - ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); - if (ret) - pte_update_defer(vma->vm_mm, addr, ptep); - return ret; -} +#define ptep_test_and_clear_young(vma, addr, ptep) ({ \ + int ret = 0; \ + if (pte_young(*ptep)) \ + ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low); \ + if (ret) \ + pte_update_defer(vma->vm_mm, addr, ptep); \ + ret; \ +}) /* * Rules for using ptep_establish: the pte MUST be a user pte, and _