Skip to contentSkip to conversation

page cache question

DISCUSSION Xin Zhao 2 participants 2 messages Feb 27, 2006

lore
Share & tools
lore

Xin Zhao

author
#0 lore raw

Sorry if this question is dumb.

Linux uses address_space to identify pages in the page cache. An address space is often associated with a memory object such as inode. That seems to associate the cached page with that inode. My question
is: if a file is closed and the inode is destroyed, will the cached page be removed from page cache immediately? If so, does that mean the file system has to load data from disk again if a user promptly open and read the same file again? If not, how does linux determine when to evict a cached page? using LRU?

Thanks in advance for your kind help!

-x

#1 lore raw
Quoted 7 lines · Xin Zhao

Sorry if this question is dumb.

Linux uses address_space to identify pages in the page cache. An address space is often associated with a memory object such as inode. That seems to associate the cached page with that inode. My question
is: if a file is closed and the inode is destroyed, will the cached page be removed from page cache immediately? If so, does that mean

Yes. The inode's struct address_space contains the radix tree which indexes the pagecache pages.

Quoted 4 lines

the file system has to load data from disk again if a user promptly open and read the same file again? If not, how does linux determine when to evict a cached page? using LRU?

Yes they would have to be read again. However in general the inode is not destroyed after the file is closed -- inodes are cached too.

Signature · 2 lines
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com