Commit 3d3f3c51 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] run flush_cache_page while pte is valid

Patch from Hugh Dickins <hugh@veritas.com>

On some architectures (cachetlb.txt gives HyperSparc as an example)
it is essential to flush_cache_page while pte is still valid: the
rmap VM diverged from the base 2.4 VM before that fix was made,
so this error has crept back into 2.5.

Patch below applies to 2.5.47 or 2.5.47-mm1 - needs more work over
shared pagetables, but they've silently fallen out of 2.5.47-mm1:
oversight?  I'll send Alan the equivalent for 2.4-ac shortly.

(I wonder, what happens if userspace now modifies the page
after the flush_cache_page, before the pte is invalidated?)
parent ea6d6fc7
...@@ -393,9 +393,9 @@ static int try_to_unmap_one(struct page * page, pte_addr_t paddr) ...@@ -393,9 +393,9 @@ static int try_to_unmap_one(struct page * page, pte_addr_t paddr)
} }
/* Nuke the page table entry. */ /* Nuke the page table entry. */
flush_cache_page(vma, address);
pte = ptep_get_and_clear(ptep); pte = ptep_get_and_clear(ptep);
flush_tlb_page(vma, address); flush_tlb_page(vma, address);
flush_cache_page(vma, address);
/* Store the swap location in the pte. See handle_pte_fault() ... */ /* Store the swap location in the pte. See handle_pte_fault() ... */
if (PageSwapCache(page)) { if (PageSwapCache(page)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment