Re: [PATCH] 2/4 move all invalidate_page outside of PT lock (#v9 was 1/4)

Christoph Lameter
2008-03-07T19:55:16Z

On Fri, 7 Mar 2008, Andrea Arcangeli wrote:

> This below simple patch invalidates the "invalidate_page" part, the
> next patch will invalidate the RCU part, and btw in a way that doesn't
> forbid unregistering the mmu notifiers at runtime (like your brand new
> EMM does).

Sounds good.

> The reason I keep this incremental (unlike your EMM that does
> everything all at the same time mixed in a single patch) is to
> decrease the non obviously safe mangling over mm/* during .25. The
> below patch is simple, but not as obviously safe as
> s/ptep_clear_flush/ptep_clear_flush_notify/.

There was never a chance to merge for .25. Lets drop that and focus on
a solution that is good for all.

> #endif /* _LINUX_MMU_NOTIFIER_H */
> diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
> --- a/mm/filemap_xip.c
> +++ b/mm/filemap_xip.c
> @@ -194,11 +194,13 @@ __xip_unmap (struct address_space * mapp
> if (pte) {
> /* Nuke the page table entry. */
> flush_cache_page(vma, address, pte_pfn(*pte));
> - pteval = ptep_clear_flush_notify(vma, address, pte);
> + pteval = ptep_clear_flush(vma, address, pte);
> page_remove_rmap(page, vma);
> dec_mm_counter(mm, file_rss);
> BUG_ON(pte_dirty(pteval));
> pte_unmap_unlock(pte, ptl);
> + /* must invalidate_page _before_ freeing the page */
> + mmu_notifier_invalidate_page(mm, address);
> page_cache_release(page);
> }
> }

Ok but we still hold the i_mmap_lock here.

> @@ -834,6 +846,8 @@ static void try_to_unmap_cluster(unsigne
> if (!pmd_present(*pmd))
> return;
>
> + start = address;
> + mmu_notifier_invalidate_range_begin(mm, start, end);

Hmmmm.. Okay you going for range invalidate here like EMM but there are
still some invalidate_pages() left.