linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Linux page cache issue?
@ 2007-03-28  6:45 Xin Zhao
  2007-03-28  7:35 ` junjie cai
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Xin Zhao @ 2007-03-28  6:45 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, Xin Zhao

Hi,

If a Linux process opens and reads a file A, then it closes the file.
Will Linux keep the file A's data in cache for a while in case another
process opens and reads the same in a short time? I think that is what
I heard before.

But after I digged into the kernel code, I am confused.

When a process closes the file A, iput() will be called, which in turn
calls the follows two functions:
iput_final()->generic_drop_inode()

But from the following calling chain, we can see that file close will
eventually lead to evict and free all cached pages. Actually in
truncate_complete_page(), the pages will be freed.  This seems to
imply that Linux has to re-read the same data from disk even if
another process B read the same file right after process A closes the
file. That does not make sense to me.

/***calling chain ***/
generic_delete_inode/generic_forget_inode()->
truncate_inode_pages()->truncate_inode_pages_range()->
truncate_complete_page()->remove_from_page_cache()->
__remove_from_page_cache()->radix_tree_delete()

Am I missing something? Can someone please provide some advise?

Thanks a lot
-x

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-04-02 12:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-28  6:45 Linux page cache issue? Xin Zhao
2007-03-28  7:35 ` junjie cai
2007-03-28  7:38 ` Matthias Kaehlcke
2007-03-28 14:10 ` Dave Kleikamp
2007-03-28 15:39   ` Xin Zhao
     [not found]     ` <alpine.DEB.0.83.0703281157010.2527@sigma.j-a-k-j.com>
2007-03-28 16:15       ` Xin Zhao
2007-03-29  9:27     ` Jan Kara
2007-03-29 14:41       ` Xin Zhao
2007-04-02 12:51         ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).