High-end memory ing in Linux

Source: Internet
Author: User

We have previously analyzed that in Linux memory management, the kernel uses 3 GB-> 4 GB address space, with a total size of 1 GB. In addition, some physical mappings (vmalloc) are used for non-contiguous spaces. Apart from this space, only m size is left for the kernel to map to the physical address. Generally, we call a region with a physical address exceeding M as high-end memory. How does the kernel manage high-end memory? Let's analyze this issue today.
The kernel has three ways to manage high-end memory. The first type is non-continuous ing. We have analyzed this in the previous vmalloc. When requesting a page in vmalloc, the request is for high-end memory and then mapped to vmalloc_start and vmalloc_end. This process is not described in detail. The second method is permanent memory ing. The last method is temporary kernel ing.
Next, analyze the second and third methods in detail.

The interfaces for permanent memory ing in the kernel are kmap ()/kunmap (). Pkmap_base: the starting address of the permanent ing space. The permanent ing space is 4 MB. Therefore, it can map up to 4 m/4 K = 1024 pages.

The interface for temporary memory ing in the kernel is kmap_atomic ()/kunmap_atomic (). The mapped address is from fixaddr_start to fixaddr_top. Each CPU occupies a certain amount of space.

 

In fact, no matter in that way, the principle is the same. It is to select an address outside the fixed ing area, and then modify the PTE item to point it to the corresponding page. It is particularly worth noting that because kmap () can cause sleep, it cannot be used for interrupt processing. However, each ing method has its own advantages and disadvantages, which requires careful consideration when writing code.

 

Analysis: In the permanent memory ing, we can see that if there is no blank entry in the pkmap_page_table page table, this ing will be blocked, therefore, we cannot call the kmap () function in atomic context (such as interrupt. In the temporary memory ing, the system does not determine whether the Pte has been used up. It adopts the overwrite policy, so the ing can always be successfully established. Blocking is the most obvious difference between temporary memory ing and permanent memory ing.

Http://blog.csdn.net/fivedoumi/article/details/7057593

Http://blog.csdn.net/fivedoumi/article/details/7057593

 

 

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.