Dirty pages in Linux write back

Source: Internet
Author: User

In order to relieve the stress of memory usage, there are mechanisms to trigger dirty page writeback in addition to the user manually writing back the dirty pages.

Let's say set a timer and write back regularly to pages that have been dirty for a long time.

The following writeback mechanism is described in detail, as this mechanism is not as passive as the mechanism of writing back a page that has been dirty for a long time.

Wakeu_bdflush the core function of the complex wake-up write-back.

Can trigger this function condition, it may be a bit more in the following points:

1. User-State process call Sync Force writeback

2.grow_buffers () When a new buffer page is allocated fails. The size of the buffer block in this page is different from the requirement, so release it.

3. The page box recycling algorithm calls the Free_more_memoy () or try_to_free_page () Alloc_pages allocator to call the following function

4. Failed to allocate elements in the memory pool. The memory pool is the last allocation method after the failure of the dynamic allocation, basically seems to drive this part to use more memory pool.

If the memory pool allocation fails, then you must trigger the dirty page writeback

Due to the above reasons, Wakeu_bdflush is awakened.

As long as this function is awakened, as long as there is a dirty page to write back, or if the dirty page exceeds a certain threshold, then the setting is written back to the number of dirty pages, and then wake up the pdflush_operation function, this function is responsible for the Pdflush kernel thread list in the selection of a free kernel thread to execute. And go to execute the callback function of this thread.

The overall performance of the callback function is to scan the Super Block list and write back if the index node that the super block belongs to has a dirty tag. And check if the Dirty page box is below the threshold, and if not, continue scanning the next super block

Dirty pages in Linux write back

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.