diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 349260cd86ededc1487131a77518f6dc6187da8e..78740716c9e74ece8e162aa0b249cf055a8e62e2 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -112,8 +112,13 @@ do { \ }) #endif -#ifndef __HAVE_ARCH_PTE_CLEAR_FULL -#define pte_clear_full(__mm, __address, __ptep, __full) \ +/* + * Some architectures may be able to avoid expensive synchronization + * primitives when modifications are made to PTE's which are already + * not present, or in the process of an address space destruction. + */ +#ifndef __HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL +#define pte_clear_not_present_full(__mm, __address, __ptep, __full) \ do { \ pte_clear((__mm), (__address), (__ptep)); \ } while (0) diff --git a/mm/fremap.c b/mm/fremap.c index aa30618ec6b2cd356c57896a2099a3e4b2a5e39c..7a9d0f5d246da922c132738f2476a688812fc1ac 100644 --- a/mm/fremap.c +++ b/mm/fremap.c @@ -39,7 +39,7 @@ static int zap_pte(struct mm_struct *mm, struct vm_area_struct *vma, } else { if (!pte_file(pte)) free_swap_and_cache(pte_to_swp_entry(pte)); - pte_clear(mm, addr, ptep); + pte_clear_not_present_full(mm, addr, ptep, 0); } return !!page; } diff --git a/mm/memory.c b/mm/memory.c index 7707187484ccce0b57b2d4bd333138b00fe479e7..2e754621d3332a288f40c23a58236f4eb5f60527 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -690,7 +690,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, continue; if (!pte_file(ptent)) free_swap_and_cache(pte_to_swp_entry(ptent)); - pte_clear_full(mm, addr, pte, tlb->fullmm); + pte_clear_not_present_full(mm, addr, pte, tlb->fullmm); } while (pte++, addr += PAGE_SIZE, (addr != end && *zap_work > 0)); add_mm_rss(mm, file_rss, anon_rss);