Re: [PATCH] swapin flush cache bug

From: Russell King (
Date: Tue Feb 13 2001 - 04:50:42 EST

Marcelo Tosatti writes:
> If lookup_swap_cache() finds a page in the swap cache, and that page was
> in memory because of the swapin readahead, the cache is not flushed.
> Here is a patch to fix the problem by always flushing the cache including
> for pages in the swap cache:

> -
> - flush_page_to_ram(page);
> - flush_icache_page(vma, page);
> }
> mm->rss++;
> +
> + flush_page_to_ram(page);
> + flush_icache_page(vma, page);

Surely if the page is in the swap cache, we don't need the
flush_page_to_ram() because the data is already written to the page. Yes,
there may be some reminents of it in the cache due to it being written
to disk via PIO.

Thinking about it some more - we have a process. It used to contain page
P at address V. We unmapped the page (and did the right thing with the
caches). Now, something wants to access address V, so we pull the page
from the swap cache, and place page P back at address V. We therefore
shouldn't need any cache manipulation at this point.

What was the problem? The old code seems to behave well on a virtual
address indexed virtual address tagged cache.

Russell King (                The developer of ARM Linux

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at

This archive was generated by hypermail 2b29 : Thu Feb 15 2001 - 21:00:21 EST