Saturday, May 23, 2009

Page Cache

during hibernation, RAM is written to swap space.

page cache is a set of radix trees that helps to quickly find out a page from the address space of object of the owner.

kinds of pages in page cache
  • regular file, directories
  • block device data
  • swapped out processes
  • file of special fs (eg, ipc shm)
page owner is the inode object. (the idea of owner of a page comes only when the page cache is in action). r/w depends on the type of owner. 3 types of owner:
  • regular file
  • block device file
  • swap area and swap cache
inode contains address space object which is the page cache (pages and methods). block device also has an inode for it. the idea of the owner based on uniqueness of resource.

the radix tree of the pages in a page cache is searched in a way similar to page table lookup. the number of bits taken for indexing depends on the height of the tree.

find_get_page() increases the page usage counter (page->count). find_lock_page() additionally sets the PG_locked flag.

the radix tree is a kind of database for the pages (by utilizing the tag field)

PG_writeback means the page is currently being written back to disk (tag[1]).

A buffer page is a page with buffer heads. every page in a page cache should be a buffer page ... isn't it?

all anon/file reads and writes are executed on RAM only. if a page gets written, the PG_dirty flag is set during page fault. if a dirty page is in an addr space, then it must be written back to disk.

the private field of a buffer page points to the buffer head of the first block.

No comments:

Post a Comment