Linux kernel source scenario analysis-memory management recovery mapping

Source: Internet
Author: User

Refill_inactive_scan and Swap_out, turn active pages into inactive, dirty pages. The principle of selection is not recently accessed, and age is less than 0.

Page_launder, the inactive dirty page becomes inactive Clean page.


Inactive Dirty pages, have the following features:

The usage count is 1;

Page->list chain into mapping->dirty_pages/clean_pages;

Page->next_hash and Page->pprev_hash chain into the global hash table;

PAGE->LRU chain into the global inactive_dirty_list;

The page->flags corresponds to set to Pg_dirty.


Inactive Clean pages, have the following features:

The usage count is 1;

Page->list chain into mapping->dirty_pages/clean_pages (keep it as is);

Page->next_hash and Page->pprev_hash chain into the global hash table;

PAGE->LRU chain into the page->zone->inactive_clean_list;.


If a page break is interrupted and you visit this webpage again, the Lookup_swap_cache will be called, the corresponding page will be found in the global hash table, and the reference count plus 1 to 2, but not yet moved to the active queue . When do you move to the active queue ?

The answers are in, Page_launder and Reclaim_page.

Page_launder:

if (pagetestandclearreferenced (page) | | | page->age > 0 | |   At this point the reference count is greater than 1                 (!page->buffers && page_count (page) > 1) | |                  Page_ramdisk (page)) {              del_page_from_inactive_dirty_list (page);              Add_page_to_active_list (page);              Continue  
    

Reclaim_page:

if (pagetestandclearreferenced (page) | | | page->age > 0 | |                  (!page->buffers && Page_count (page) > 1)) {//At this time the reference count is greater than 1            del_page_from_inactive_clean_list (page);              Add_page_to_active_list (page);              Continue;  }  

Linux kernel source scenario analysis-memory management recovery mapping

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.