Stephen C. Tweedie wrote:
 > First, don't we want to do a flush_page_to_ram() *before* starting the
 > swap IO?
Well, let me explain the issue.  It is the thing we need to do
flushing *after* I/O.
--------------------------
Problem with virtually indexed physically tagged write-back cache.
(1) Page got swapped out
           Swap out
   [ Page ] ----> [ Disk ]
(2) Page got swapped in asynchronously, possibly by read-ahead
           Swap in
   [ Page ] <---- [ Disk ]
	   K
   The I/O from disk goes through kernel virtual address K.
   We have cache entries indexed by K.
(3) Page fault occurs at user space U
   U ----> [ Page ] -----> [ Disk ]
		   K
   The control goes to do_swap_page, found the page at
   lookup_swap_cache.
   If K and U indexes differently, we have cache alias issues, we need
   to flush the entries indexed by K and let them go to memory.  Or else, 
   user space will see bogus data in Page.
-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/