install_page() needs to run flush_cache_page() prior to overwriting an already-established pte. mm/fremap.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff -puN mm/fremap.c~install_page-flush_cache_page mm/fremap.c --- 25/mm/fremap.c~install_page-flush_cache_page 2003-03-24 00:21:07.000000000 -0800 +++ 25-akpm/mm/fremap.c 2003-03-24 00:30:56.000000000 -0800 @@ -17,7 +17,8 @@ #include #include -static inline int zap_pte(struct mm_struct *mm, pte_t *ptep) +static inline int zap_pte(struct mm_struct *mm, struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep) { pte_t pte = *ptep; @@ -26,6 +27,7 @@ static inline int zap_pte(struct mm_stru if (pte_present(pte)) { unsigned long pfn = pte_pfn(pte); + flush_cache_page(vma, addr); pte = ptep_get_and_clear(ptep); if (pfn_valid(pfn)) { struct page *page = pfn_to_page(pfn); @@ -54,7 +56,7 @@ int install_page(struct mm_struct *mm, s unsigned long addr, struct page *page, pgprot_t prot) { int err = -ENOMEM, flush; - pte_t *pte, entry; + pte_t *pte; pgd_t *pgd; pmd_t *pmd; struct pte_chain *pte_chain; @@ -73,13 +75,12 @@ int install_page(struct mm_struct *mm, s if (!pte) goto err_unlock; - flush = zap_pte(mm, pte); + flush = zap_pte(mm, vma, addr, pte); mm->rss++; flush_page_to_ram(page); flush_icache_page(vma, page); - entry = mk_pte(page, prot); - set_pte(pte, entry); + set_pte(pte, mk_pte(page, prot)); pte_chain = page_add_rmap(page, pte, pte_chain); pte_unmap(pte); if (flush) _