Re: [PATCH] swapin flush cache bug

From: NIIBE Yutaka (
Date: Tue Feb 13 2001 - 21:08:07 EST

Alan Cox wrote:
> Ok we need to handle that case a bit more intelligently so those flushes dont
> get into other ports code paths.

Possibly at fs/buffer.c:end_buffer_io_async?

We need to flush the cache when I/O was READ or READA. Is there any
way for end_buffer_io_async to distinguish which I/O (READ or WRITE)
has been done?

Problem with write-back cache.

(1) Page got swapped out

           Swap out
   [ Disk ] <---- P [ Page ]

(2) Page got swapped in asynchronously, possibly by read-ahead

           Swap in
   [ Disk ] ----> P [ Page ]

   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

   [ Disk ] P [ Page ] <----- U

   The control goes to do_swap_page, found the page at

   If K and U indexes differently, we have cache alias issues,
   we need to flush the entries indexed by K.

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:23 EST