Skip to main content
added 486 characters in body
Source Link
sourcejedi
  • 53.6k
  • 23
  • 179
  • 337

PTE's represent virtual pages. As you say, when a virtual page is present in main memory, the PTE's address field will hold the physical Page Frame Number (PFN).

Each physical page has a corresponding struct page. This has:

Following flags is:

struct address_space *mapping; 

For pages that are in the page cache (a large portion of the pages on most systems), mapping points to the information needed to access the file that backs up the page. If, however, the page is an anonymous page (user-space memory backed by swap), then mapping will point to an anon_vma structure [...]

-- Cramming more into struct page, LWN.net

Then, the page→index field is used to store the swp_entry_t structure for anonymous pages. (For

swp_entry_t holds the index of a swap device, and a location within that swap device.

For pages in the page cache, this holds a file offset)...

-- Rephrased from Understanding the Linux Virtual Memory Manager, Mel Gorman, 2004.

...and for pages in the page cache, I think some versions of Linux did rely on the page→index field , using it to implement non-linear mappings.

However, as non-linear mappings are no longer supported, page→index appears to be redundant in this case? So you should read the other answer about VMA's.

PTE's represent virtual pages. As you say, when a virtual page is present in main memory, the PTE's address field will hold the physical Page Frame Number (PFN).

Each physical page has a corresponding struct page. This has:

Following flags is:

struct address_space *mapping; 

For pages that are in the page cache (a large portion of the pages on most systems), mapping points to the information needed to access the file that backs up the page. If, however, the page is an anonymous page (user-space memory backed by swap), then mapping will point to an anon_vma structure [...]

-- Cramming more into struct page, LWN.net

Then, the page→index field is used to store the swp_entry_t structure for anonymous pages. (For pages in the page cache, this holds a file offset).

-- Rephrased from Understanding the Linux Virtual Memory Manager, Mel Gorman, 2004.

PTE's represent virtual pages. As you say, when a virtual page is present in main memory, the PTE's address field will hold the physical Page Frame Number (PFN).

Each physical page has a corresponding struct page. This has:

Following flags is:

struct address_space *mapping; 

For pages that are in the page cache (a large portion of the pages on most systems), mapping points to the information needed to access the file that backs up the page. If, however, the page is an anonymous page (user-space memory backed by swap), then mapping will point to an anon_vma structure [...]

-- Cramming more into struct page, LWN.net

Then, the page→index field is used to store the swp_entry_t structure for anonymous pages.

swp_entry_t holds the index of a swap device, and a location within that swap device.

For pages in the page cache, this holds a file offset...

-- Rephrased from Understanding the Linux Virtual Memory Manager, Mel Gorman, 2004.

...and for pages in the page cache, I think some versions of Linux did rely on the page→index field , using it to implement non-linear mappings.

However, as non-linear mappings are no longer supported, page→index appears to be redundant in this case? So you should read the other answer about VMA's.

Rollback to Revision 2
Source Link
sourcejedi
  • 53.6k
  • 23
  • 179
  • 337

PTE's represent virtual pages. As you say, when a virtual page is present in main memory, the PTE's address field will hold the physical Page Frame Number (PFN).

Each physical page has a corresponding struct page. This has:

Following flags is:

struct address_space *mapping; 

For pages that are in the page cache (a large portion of the pages on most systems), mapping points to the information needed to access the file that backs up the page. If, however, the page is an anonymous page (user-space memory backed by swap), then mapping will point to an anon_vma structure [...]

-- Cramming more into struct page, LWN.net

Then, the page→index field holdsis used to store the file offset (for pages in the page cache), or a swp_entry_t structure (forfor anonymous pages).

swp_entry_t holds (For pages in the index of a swap devicepage cache, andthis holds a location within that swap devicefile offset).

Specific details of how this worked in... 2004... can be found in-- Rephrased from Understanding the Linux Virtual Memory Manager - Swap management, written by Mel Gorman, 2004.

PTE's represent virtual pages. As you say, when a virtual page is present in main memory, the PTE's address field will hold the physical Page Frame Number (PFN).

Each physical page has a corresponding struct page. This has:

Following flags is:

struct address_space *mapping; 

For pages that are in the page cache (a large portion of the pages on most systems), mapping points to the information needed to access the file that backs up the page. If, however, the page is an anonymous page (user-space memory backed by swap), then mapping will point to an anon_vma structure [...]

-- Cramming more into struct page, LWN.net

Then, the page→index field holds the file offset (for pages in the page cache), or a swp_entry_t structure (for anonymous pages).

swp_entry_t holds the index of a swap device, and a location within that swap device.

Specific details of how this worked in... 2004... can be found in Understanding the Linux Virtual Memory Manager - Swap management, written by Mel Gorman.

PTE's represent virtual pages. As you say, when a virtual page is present in main memory, the PTE's address field will hold the physical Page Frame Number (PFN).

Each physical page has a corresponding struct page. This has:

Following flags is:

struct address_space *mapping; 

For pages that are in the page cache (a large portion of the pages on most systems), mapping points to the information needed to access the file that backs up the page. If, however, the page is an anonymous page (user-space memory backed by swap), then mapping will point to an anon_vma structure [...]

-- Cramming more into struct page, LWN.net

Then, the page→index field is used to store the swp_entry_t structure for anonymous pages. (For pages in the page cache, this holds a file offset).

-- Rephrased from Understanding the Linux Virtual Memory Manager, Mel Gorman, 2004.

question authors later comment indicates that they were primarily asking about file-backed pages.
Source Link
sourcejedi
  • 53.6k
  • 23
  • 179
  • 337

PTE's represent virtual pages. As you say, when a virtual page is present in main memory, the PTE's address field will hold the physical Page Frame Number (PFN).

Each physical page has a corresponding struct page. This has:

Following flags is:

struct address_space *mapping; 

For pages that are in the page cache (a large portion of the pages on most systems), mapping points to the information needed to access the file that backs up the page. If, however, the page is an anonymous page (user-space memory backed by swap), then mapping will point to an anon_vma structure [...]

-- Cramming more into struct page, LWN.net

Then, the page→index field is used to storeholds the file offset swp_entry_t structure for anonymous pages. (Forfor pages in the page cache), this holdsor a file offset swp_entry_t structure (for anonymous pages).

swp_entry_t holds the index of thea swap device, and thea location within that swap device.

Specific details of how this worked in... 2004... can be found in Understanding the Linux Virtual Memory Manager - Swap management, written by Mel Gorman.

PTE's represent virtual pages. As you say, when a virtual page is present in main memory, the PTE's address field will hold the physical Page Frame Number (PFN).

Each physical page has a corresponding struct page. This has:

Following flags is:

struct address_space *mapping; 

For pages that are in the page cache (a large portion of the pages on most systems), mapping points to the information needed to access the file that backs up the page. If, however, the page is an anonymous page (user-space memory backed by swap), then mapping will point to an anon_vma structure [...]

-- Cramming more into struct page, LWN.net

Then, the page→index field is used to store the swp_entry_t structure for anonymous pages. (For pages in the page cache, this holds a file offset).

swp_entry_t holds the index of the swap device, and the location within that swap device.

Specific details of how this worked in... 2004... can be found in Understanding the Linux Virtual Memory Manager - Swap management, written by Mel Gorman.

PTE's represent virtual pages. As you say, when a virtual page is present in main memory, the PTE's address field will hold the physical Page Frame Number (PFN).

Each physical page has a corresponding struct page. This has:

Following flags is:

struct address_space *mapping; 

For pages that are in the page cache (a large portion of the pages on most systems), mapping points to the information needed to access the file that backs up the page. If, however, the page is an anonymous page (user-space memory backed by swap), then mapping will point to an anon_vma structure [...]

-- Cramming more into struct page, LWN.net

Then, the page→index field holds the file offset (for pages in the page cache), or a swp_entry_t structure (for anonymous pages).

swp_entry_t holds the index of a swap device, and a location within that swap device.

Specific details of how this worked in... 2004... can be found in Understanding the Linux Virtual Memory Manager - Swap management, written by Mel Gorman.

added 165 characters in body
Source Link
sourcejedi
  • 53.6k
  • 23
  • 179
  • 337
Loading
deleted 1 character in body
Source Link
sourcejedi
  • 53.6k
  • 23
  • 179
  • 337
Loading
Source Link
sourcejedi
  • 53.6k
  • 23
  • 179
  • 337
Loading