Linux Physical Memory Allocation in Specified Address Range
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current methods for allocating physical memory in a Linux system are inefficient, particularly when trying to allocate large amounts of memory in a specified address range, as they either waste resources by occupying adjacent pages or cannot allocate memory in a specific address range due to kernel data structure restrictions.
Innovation Solution
A method that examines each node and zone for intersection with a specified address range, searches for memory blocks in the per-CPU page frame cache and buddy system, splits memory blocks as needed, and allocates them efficiently to meet the required size and address range, avoiding redundant memory occupation.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Manufacturing precision
If the first method (allocating specified physical memory pages) is used, then the physical memory can be allocated in a specified address range, but the allocation efficiency is low and adjacent memory pages are occupied causing resource waste
Solution Approach 1:
The patent segments the memory allocation process into two distinct phases: first allocating a large continuous memory block from the buddy system without address constraints, then segmenting this block into smaller pages and filtering them by address range. This segmentation approach allows efficient bulk allocation while maintaining precise address control, resolving the contradiction between allocation efficiency and address specification precision.
2Productivity
If the second method (calling interface of continuous physical memories) is used, then a large amount of physical memories can be allocated, but the physical memories cannot be allocated in a specified address range
Solution Approach 1:
The patent applies preliminary action by first allocating a large continuous memory block from the buddy system before filtering it by address range. This preliminary bulk allocation ensures high efficiency and sufficient memory quantity, while the subsequent address filtering step adds the required flexibility for specified address ranges without compromising the initial efficient allocation.
3Manufacturing precision
If memory blocks are allocated one page at a time, then the allocation can be precise to the page level, but the allocation process is time-consuming and may occupy other adjacent memory pages
Solution Approach 1:
The patent merges the allocation of multiple memory pages into a single bulk allocation operation from the buddy system, rather than allocating pages individually. This combining approach dramatically reduces allocation time and eliminates the problem of occupying adjacent pages, while the subsequent address filtering ensures precise control over which specific pages within the allocated block are actually used.
Data Source
AI summary
A method of allocating a physical memory in a specified address range under a Linux system platform is applied in a testing process of a physical memory under a Linux operating system. In this method, according to a specified address range and a size of a memory to be allocated, a large amount of physical memories in the system are allocated in a specified address range, and then the information about the allocated memories is transmitted, so as to map, inspect, and release the memories, thereby effectively supporting the test for physical memories under the Linux operating system.


