Skip to content

Commit 9888a1c

Browse files
Zachary AmsdenLinus Torvalds
Zachary Amsden
authored and
Linus Torvalds
committed
[PATCH] paravirt: pte clear not present
Change pte_clear_full to a more appropriately named pte_clear_not_present, allowing optimizations when not-present mapping changes need not be reflected in the hardware TLB for protected page table modes. There is also another case that can use it in the fremap code. Signed-off-by: Zachary Amsden <[email protected]> Signed-off-by: Jeremy Fitzhardinge <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Andi Kleen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 3dc9079 commit 9888a1c

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

include/asm-generic/pgtable.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,13 @@ do { \
112112
})
113113
#endif
114114

115-
#ifndef __HAVE_ARCH_PTE_CLEAR_FULL
116-
#define pte_clear_full(__mm, __address, __ptep, __full) \
115+
/*
116+
* Some architectures may be able to avoid expensive synchronization
117+
* primitives when modifications are made to PTE's which are already
118+
* not present, or in the process of an address space destruction.
119+
*/
120+
#ifndef __HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL
121+
#define pte_clear_not_present_full(__mm, __address, __ptep, __full) \
117122
do { \
118123
pte_clear((__mm), (__address), (__ptep)); \
119124
} while (0)

mm/fremap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static int zap_pte(struct mm_struct *mm, struct vm_area_struct *vma,
3939
} else {
4040
if (!pte_file(pte))
4141
free_swap_and_cache(pte_to_swp_entry(pte));
42-
pte_clear(mm, addr, ptep);
42+
pte_clear_not_present_full(mm, addr, ptep, 0);
4343
}
4444
return !!page;
4545
}

mm/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
690690
continue;
691691
if (!pte_file(ptent))
692692
free_swap_and_cache(pte_to_swp_entry(ptent));
693-
pte_clear_full(mm, addr, pte, tlb->fullmm);
693+
pte_clear_not_present_full(mm, addr, pte, tlb->fullmm);
694694
} while (pte++, addr += PAGE_SIZE, (addr != end && *zap_work > 0));
695695

696696
add_mm_rss(mm, file_rss, anon_rss);

0 commit comments

Comments
 (0)