Department of Computer Science
University of São Paulo
São Paulo, Brazil
Linux 2.4 Virtual Memory Overview
under heavy construction
On this page you can find some of our studies of Linux 2.4 VM system. This
page was created to help us out to visualize VM system better. WARNING:
this material is still very raw and some ideas may have not been correctly
understood. If you have any suggestion or correction, please send an e-mail to
us at [email protected].
function descriptions - per file
- WKdm.c
- bootmem.c
- comp_cache.c
- filemap.c
- highmem.c
- memory.c
- mlock.c
- mmap.c
- mmap_avl.c
- mprotect.c
- mremap.c
- numa.c
- oom_kill.c
- page_alloc.c
- page_io.c
- shmem.c
- slab.c
- swap.c
- swap_state.c
- swapfile.c
- vmalloc.c
- vmscan.c
References
Rik van Riel, Too little, too slow; memory management, lecture.
(html)
Linux 2.4 source code
Help from #kernelnewbies irc channel (irc.openprojects.net)
logic of 2.4 Linux MM - schemes and sketches
multi-queue
active list
- per node/pgdat
- contains pages with page->age > 0
- pages may be mapped into processes
- page aging happens on these pages
inactive_dirty list
- per zone
- contains dirty, old pages (page->age == 0)
- pages are not mapped in any process
inactive_clean list
- per zone
- contains clean, old pages
- can be reused by __alloc_pages, like free pages
- pages are not mapped in any process
free_list
- per zone
- contains pages with no useful data
- we want to keep a few (dozen) of these around for
recursive allocations
- only page cache pages are on any list
- pages are not on any list if they are anonymous pages
- when you have a no_page fault, do_anonymous_page() is
called, but page is not yet added to any list
- only pages added to page cache and to swap cache are added to
active list if they are not from any of the lists.
- these following functions actually add page to active list (if not on any list):
- age_page_up() (see aging section)
- add_to_page_cache*() - called by:
- do_generic_file_read()
- page_cache_read()
- read_cache_page()
- grab_cache_page()
swap cache
- swap cache is part of page cache
- add_to_swap_cache() only sets some flags
and calls add_to_page_cache_locked().
- only:
- try_to_swap_out() (to swap a page out),
- read_swap_cache_async() (to swap in) and
- shmem_writepage() (to write a shared memory page)
call add_to_swap_cache().
- only dirty swap cache pages are swapped out (in
page_launder()).
aging
- age_page_up*() is only called by:
- filemap.c::__find_page_nolock()
- vmscan.c::try_to_swap_out()
- vmscan.c::refill_inactive_scan()
- age_page_down*() is called by:
- vmscan.c::try_to_swap_out()
- vmscan.c::refill_inactive_scan()
kreclaimd()
kswapd()
refill_inactive() - basic idea
do_try_to_free_pages() - basic idea
Page last updated on "Fri Oct 5 14:42:20 2001"
Send feedback to
Rodrigo S. de Castro<[email protected]>