Re: invalidate_inode_pages in 2.5.32/3

Rik van Riel
2002-09-12T22:25:38Z

On Thu, 12 Sep 2002, Andrew Morton wrote:

> Well the lazy invalidation would be OK - defer that to the next
> userspace access,

I think I have an idea on how to do that, here's some pseudocode:

invalidate_page(struct page * page) {
SetPageInvalidated(page);
rmap_lock(page);
for_each_pte(pte, page) {
make pte PROT_NONE;
flush TLBs for this virtual address;
}
rmap_unlock(page);
}

And in the page fault path:

if (pte_protection(pte) == PROT_NONE && PageInvalidated(pte_page_pte)) {
clear_pte(ptep);
page_cache_release(page);
mm->rss--;
}

What do you think, is this simple enough that it would work ? ;)

regards,

Rik
--
Bravely reimplemented by the knights who say "NIH".

http://www.surriel.com/ http://distro.conectiva.com/

Spamtraps of the month: september@surriel.com trac@trac.org