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

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

    inactive_dirty list

    inactive_clean list

    free_list

    1. only page cache pages are on any list
    2. 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
    3. only pages added to page cache and to swap cache are added to active list if they are not from any of the lists.
    4. 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

    1. swap cache is part of page cache
    2. add_to_swap_cache() only sets some flags and calls add_to_page_cache_locked().
    3. 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().
    4. only dirty swap cache pages are swapped out (in page_launder()).

    aging

    1. age_page_up*() is only called by:
      • filemap.c::__find_page_nolock()
      • vmscan.c::try_to_swap_out()
      • vmscan.c::refill_inactive_scan()
    2. 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


    SourceForge Logo

    Page last updated on "Fri Oct 5 14:42:20 2001"
    Send feedback to
    Rodrigo S. de Castro<[email protected]>