Linux VM balance Translation

Source: Internet
Author: User

Memory Allocation without the sign of _ gfp_wait and gfp_io needs to be balanced.

There are two reasons for allocation of non _ gfp_wait: 1. The caller cannot sleep (especially in the context of interruption ). 2. or for some reason, you do not want to spend time on page allocation or swap Io.

The _ gfp_io flag is used to prevent deadlocks in the file system.

If there is a lack of sleep memory allocation requests, it seems harmful to balance the memory. Page recycling can be performed only when zone free memory is 0, rather than actively.

That being said, the kernel shocould try to fulfill requests for direct Mapped pages from the direct mapped pool,

Instead of falling back onthe DMA pool, so as to keep the DMA pool filled for DMA requests (atomicor not ).This method is also suitable for high-end memory and direct page ing. If there are a lot of idle DMA pages, direct allocation from the DMA memory pool can well meet the general allocation requests, without the need to spend time to balance the zone memory.

At 2.2, the memory balance and page reclaim will be triggered only when the idle page rate is lower than 1/64 Of the total memory. Due to the ratio of DMA to common memory, it is very likely that the DMA memory is completely empty and there will be no memory balance. 2.2 is usually run on a machine with multiple memories. The problem occurs immediately and seems to work well. In 2.3, the problem became more serious because of the high-end memory.

In 2.3, the balance zone can take one of two ways: depending on the size of the Zone (probably the size of the lower class zone), we can determine the desired idle page during initialization, the memory is balanced by times. The good thing is that we don't need to check the lower class zones size. The bad thing is that we ignore the lower class zones usage, so we need to balance it frequently. Also, with a slight change in the allocation routine, it is possible to reduce the memclass () macro to be a simple algorithm ity.

Another solution is to balance the idle rate of a zone and the lower class zones of the zone with a value lower than 1/64 Of the total memory. This solves 2.2 of the problem and keeps the same handling behavior as 2.2. Of course, balanceAlgorithmIt is the same in different structural systems. If we want to do better, we can assign different weights to different zones in the future.

Note that if the normal zone is much larger than the DMA zone, the DMA zone will hardly work when balancing the normal zone. The first solution can be better handled.

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.