Linux Memory Management 6---partner algorithms and Slab

Source: Internet
Author: User

1. Preface

The series of articles about memory management in this article is mainly about the memory management knowledge lecture of Chen Li June teacher.

This lecture is divided into three topics on memory management: Hardware foundation of memory management, management of virtual address space, management of physical address space.

This paper mainly introduces the X86 architecture as an example to introduce the partner algorithm and slab assignment

2. Overview of partner Algorithms
    • Block Linked list

The Linux partner algorithm divides all the free pages into max_order+1 (max_order default size is 11) block list

One node in each list points to a block containing 2 of a power page, either a block of pages or a block of abbreviations

    • Partner

Two page blocks of the same size and physical address contiguous are called partners

    • How partner algorithms work

First in the size to meet the requirements of the block list to find whether there are free blocks, if any, directly allocated, otherwise in the larger block list of the block list;

The inverse process is the release of the block, which merges the blocks that satisfy the partnership, forming a larger block and inserting it into the corresponding block list

3. Data structures related to the partner algorithm

Each page box corresponds to a struct page instance

Each memory area is associated with a struct zone zone, which is managed with a Free_area array for the free page box

4. Example of a partner algorithm structure

Diagram Partner algorithm structure example diagram

5. Partner algorithm Allocation principle

6. Implementation of Page box assignment

7. Physical memory Allocator

Two memory allocators based on partner algorithm, per-CPU cache, and slab cache

    • Partitioned page box allocator (zoned page frame allocator)

Handles memory allocation requests to contiguous page boxes. The partition page box allocator is divided into two parts: the admin area Distributor and the partner system

The Admin Area Distributor is responsible for searching a management area which can satisfy the request page frame size;

In each management area, the specific page frame assignment is the responsibility of the partner system, and for better performance, the request for a single page box is done directly by the per-CPU page box cache

Figure Partition Page Box Splitter example diagram

    • Slab Dispenser

A variety of allocation object partitions are put into the cache, that is, each cache has a "reserve" for the same type of allocated objects

Linux Memory Management 6---partner algorithms and Slab

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.