Re: [RFC] Notifier for Externally Mapped Memory (EMM)

Andrea Arcangeli
2008-03-04T13:30:31Z

On Mon, Mar 03, 2008 at 11:31:15PM -0800, Christoph Lameter wrote:
> @@ -446,6 +450,8 @@ static int page_mkclean_one(struct page
> if (address == -EFAULT)
> goto out;
>
> + /* rmap lock held */
> + emm_notify(mm, emm_invalidate_start, address, address + PAGE_SIZE);
> pte = page_check_address(page, mm, address, &ptl);
> if (!pte)
> goto out;
> @@ -462,6 +468,7 @@ static int page_mkclean_one(struct page
> }
>
> pte_unmap_unlock(pte, ptl);
> + emm_notify(mm, emm_invalidate_end, address, address + PAGE_SIZE);
> out:
> return ret;
> }

I could have ripped invalidate_page from my patch too, except I didn't
want to slow down those paths for the known-common-users when not even
GRU would get any benefit from two hooks when only one is needed.

When working with single pages it's more efficient and preferable to
call invalidate_page and only later release the VM reference on the
page.