Re: [patch 3/9] Guest page hinting: volatile page cache.

Martin Schwidefsky
2006-09-04T11:21:27Z

On Fri, 2006-09-01 at 11:41 -0700, Dave Hansen wrote:
> While something like the following wouldn't be scalable, it would
> functionally work, right?
>
> +static void __page_discard(struct page *page)
> +{
> + spin_lock(discard_lock);
> ...
> + spin_unlock(discard_lock);
> +}
>
> +void __delete_from_swap_cache(struct page *page)
> +{
> + spin_lock(discard_lock);
> ...
> + spin_unlock(discard_lock);
> +}
>
> +void __remove_from_page_cache(struct page *page)
> +{
> + spin_lock(discard_lock);
> ...
> + spin_unlock(discard_lock);
> +}

Any kind of locking won't work. You need the information that a page has
been discarded until the page has been freed. Only then the fact that
the page has been discarded may enter nirvana. Any kind of lock needs to
be freed again to allow the next discard fault to happen. Since you
don't when the last page reference is returned you cannot hold the lock
until the page is free.

--
blue skies,
Martin.

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH

"Reality continues to ruin my life." - Calvin.

--
VGER BF report: H 0