Linux-MM
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Linux Memory Management

  • Front Page

  • Documentation

  • Internals

  • Projects

  • Academic Research

References

  • LinuxKernelMailingLists

  • MemoryManagementLinks

Related sites

  • Kernel Newbies

  • Memory Management Forum

Wiki

  • Site Editors

  • Side Bar

  • Hosted by WikiWall

Navigation

  • RecentChanges
  • FindPage
  • HelpContents
Revision 2 as of 2017-12-30 01:05:11
LinuxMM:
  • SwapEntryRepresentation

A swap entry has two parts, one called the type (stored in an unsigned long), and one called the offset (stored in a data structure called a pgoff_t). The type is the swap area (partition or file) to use (there can be up to 32), the offset is the number of page sized (4kb) chunks to count from the beginning of the type. They’re both stored in a swap_entry_ t, which is an unsigned long stored inside a struct for protection. A swap_entry_t is created and manipulated through functions that live in include/linux/swapops.h. There is, for instance,

  • swp_entry() which takes a type and offset and returns a newly created swap_entry_t
  • swp_type() and swp_offset() which take a swp_entry_t and return the extracted type (unsigned long) and a pgoff_t, respectively
  • swp_entry_to_pte(), which takes a swap_entry_t and converts it into its corresponding and analogous page table entry, i.e. pte_t
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01