A page table memory allocation method, a computer-readable storage medium, and an electronic device.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-08-14
AI Technical Summary
受本地内存特性影响,在进行数据存储或读取时,操作系统优先将页表分配至与本地内存对应的内存节点中,可能导致本地内存空间已经不足或用完的情况下,远端内存仍有较多空间,严重影响操作系统的性能
[0003]本申请实施例的目的在于提供一种页表内存分配方法、计算机可读存储介质及电子设备。
Smart Images

Figure CN122570184A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a page table memory allocation method, a computer-readable storage medium, and an electronic device. Background Technology
[0002] For operating systems (OS) of electronic devices, several issues arise when they utilize both local memory and remote memory. From a hardware perspective, taking a processor (CPU) as an example, the processor uses both local memory (e.g., DDR) and remote memory (e.g., Compute Express Link). From the operating system's perspective, for the same processor, the operating system treats the local memory (which interacts with the processor) as one memory node and the remote memory as another. Due to the characteristics of local memory, during data storage or retrieval, the operating system prioritizes allocating page tables to the memory node corresponding to local memory. This can lead to situations where local memory is insufficient or exhausted, while remote memory still has ample space, severely impacting operating system performance. Summary of the Invention
[0003] The purpose of this application is to provide a page table memory allocation method, a computer-readable storage medium, and an electronic device.
[0004] The embodiments of this application adopt the following technical solution: a page table memory allocation method, the method comprising: Check whether the server running the operating system has remote memory; When remote memory is available, the space corresponding to the memory pool is allocated from the page table of the local memory. In response to a page table memory allocation request, determine whether the local memory space is not lower than the threshold. If the local memory space is not higher than the threshold, page table allocation is performed from the reserved page table allocation memory pool in the local memory.
[0005] In some embodiments, the memory resources of the page table allocated memory pool are uniquely obtained from local memory, and the page table allocated memory pool has independent memory nodes corresponding to the number of server paths.
[0006] In some embodiments, the method further includes, If the local memory space is not higher than the threshold, the operating system is prohibited from starting the memory overflow termination mechanism.
[0007] In some embodiments, the method further includes, When the space in the local memory corresponding to the page table allocated memory pool is used, memory is forcibly added from the local memory to the page table allocated memory pool to refill the page table allocated memory pool resources.
[0008] In some embodiments, the method further includes, If memory is successfully replenished from local memory, the emergency availability of the page table-allocated memory pool will continue to be maintained. If the attempt to add memory fails, a memory allocation error will be reported to the operating system.
[0009] In some embodiments, the method further includes, If the local memory space is not lower than the threshold, then page table memory is allocated according to the operating system's native memory allocation mechanism.
[0010] In some embodiments, the method further includes, After completing the page table memory allocation, return the memory address of the allocated page table to confirm the successful execution of the page table allocation operation.
[0011] In some embodiments, the method further includes, The response to the page table memory allocation request follows the principle that page table memory is allocated only from local memory-related resources, and the page table memory is determined according to traversal rules.
[0012] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method described in any of the above embodiments.
[0013] This application also provides an electronic device, including a processor and a memory, wherein the processor is used to perform: Check whether the server running the operating system has remote memory; When remote memory is available, the space corresponding to the memory pool is allocated from the page table of the local memory. In response to a page table memory allocation request, determine whether the local memory space is not lower than the threshold. If the local memory space is not higher than the threshold, page table allocation is performed from the reserved page table allocation memory pool in the local memory. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 This diagram illustrates the working mode of allocating page tables from the operating system memory allocator in 1LM Vol volatile mode.
[0016] Figure 2 This diagram illustrates the use of a memory stress tool to perform memory stress testing on the operating system.
[0017] Figure 3 This is a flowchart illustrating the page table memory allocation method used in this application.
[0018] Figure 4 This is a flowchart illustrating one method for allocating page table memory in this application.
[0019] Figure 5 This is a schematic diagram illustrating the process of allocating page tables from reserved local memory for this application.
[0020] Figure 6 This is a structural block diagram of the electronic device of this application. Detailed Implementation
[0021] Various embodiments and features of this application are described herein with reference to the accompanying drawings.
[0022] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.
[0023] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0024] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0025] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application.
[0026] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0027] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.
[0028] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.
[0029] First, a brief introduction will be given to the technical terms and application scenarios involved in the embodiments of this application.
[0030] Memory nodes, combined Figure 1 A Memory Node (NUMA node) is the smallest unit for dividing memory and CPU in a NUMA architecture server. NUMA is a non-uniform memory access architecture used in multi-processor servers. One CPU / group of CPUs, along with its locally connected memory, constitutes a memory node. If the CPU is directly connected to local memory and also connected to remote memory (e.g., CXL), in 1LM Vol volatile mode, it can be divided into hierarchical independent nodes: Node 0 (local memory node) and Node 1 (CXL remote memory node). Node 0 is assigned to all cores of the current CPU and the CPU's directly connected local memory (DDR: Double Data Rate, Synchronous Dynamic Random Access Memory). All onboard DDR channels and memory controllers are assigned to Node 0. CPU cores accessing node 0 memory are treated as local access, resulting in the lowest latency and highest bandwidth. Node 1 is assigned to only CXL extended memory, with no CPU cores attached to this node. All CXL memory space is assigned to Node 1. CPU accessing node 1 memory is treated as cross-node remote access, resulting in high latency and low bandwidth. When allocating page tables, the page table allocation strategy is as follows: when allocating page table memory from the operating system memory allocator, it will force allocation from the local DDR of Node0 to avoid page tables falling on remote nodes of CXL and causing continuous high latency.
[0031] As described in the background section, some problems arise when the operating system uses both local memory and remote memory simultaneously. For example, one application scenario is as follows: Figure 2As shown, when using the memory stress tool to perform operating system memory stress testing, due to the limitations of the existing CPU hardware architecture, the operating system allocates page table storage space from DDR instead of using CXL remote memory. This results in a situation where the memory space in DDR is nearly exhausted or already depleted, while there is still a significant amount of free memory in CXL. On the one hand, this prevents the achievement of a good memory stress test effect. On the other hand, when the DDR memory space is exhausted, the memory overflow killer (OOM Killer) starts terminating some processes, which adversely affects the performance of the operating system. For example, the terminated processes may include the memory stress tool process, causing the test to be interrupted.
[0032] To solve the above problems, combined with Figure 3 , Figure 4 and Figure 5 This application provides a page table memory allocation method, the method comprising: S10 checks whether the server running the operating system has remote memory.
[0033] For example, the firmware uses ACPI (Advanced Configuration and Power Interface) to write hardware information such as CPU, memory, CXL, and NUMA topology into standardized tables. The operating system reads these tables to identify and schedule the hardware. When the operating system boots up, it can scan all hardware and use these tables to identify whether the server running the operating system has remote memory CXL.
[0034] S20, when remote memory is available, allocates the space corresponding to the memory pool from the page table set in local memory.
[0035] For example, in the case of a server running an operating system with remote memory, it can be determined that the server in this application, in addition to local memory, also has remote memory connected to the CPU. In this embodiment, the operating system running on the server can be in 1LM Vol mode with independent NUMA nodes. In this case, space corresponding to the page table allocation memory pool is reserved from the local DDR memory directly connected to the CPU. Here, the page table allocation memory pool is a contiguous memory buffer pre-reserved by the kernel in physical memory specifically for storing page tables at various levels (e.g., PML4E), and is uniformly managed by the operating system memory allocator. The page table allocation memory pool physically separates the memory required for page tables from the CXL remote memory, preventing allocation to remote CXL nodes. This forces the entire page table allocation memory pool to reside in local DDR, avoiding page tables residing in CXL remote memory.
[0036] When the server has CXL remote memory, allocating the memory pool space corresponding to the page table from local memory can eliminate cross-node access for address translation. For each virtual address access, the CPU must first read the page table to complete the virtual-to-physical address translation. If the page table is located in CXL remote memory, every memory access will trigger a cross-NUMA node CXL link read, resulting in significantly increased latency, frequent cache invalidation, and other problems that severely impact server performance. Allocating the memory pool space corresponding to the page table from local memory, with its dedicated DDR page table allocation pool, ensures that all page table physical addresses are located locally, and address translation is entirely local access, without the involvement of CXL links.
[0037] Taking the scenario of using a memory stress testing tool to perform operating system memory stress testing as an example, during memory stress testing, massive memory allocation across the entire machine generates a huge number of page tables. Without a local page table allocation pool, page tables are randomly allocated to CXL, amplifying the load through cross-node read / write operations, resulting in numerous machine check anomalies and latency issues during testing. However, the embodiment of this application deploys a dedicated local page table allocation pool, where page table allocation converges to the local DDR. The stress test results accurately reflect memory performance, are accurate and controllable, and improve the stability of the overall machine memory stress test.
[0038] S30, in response to a page table memory allocation request, determines whether the local memory space is not lower than the threshold.
[0039] For example, when data needs to be read / stored, a page table memory allocation request is generated. In response to this request, a page table is allocated from local memory. As page table allocation proceeds, local memory space decreases. Therefore, during page table allocation, the amount of free local memory can be detected. If a significant amount of free local memory is detected, a page table can be allocated from the operating system's memory allocator using the normal page table allocation method, which will not immediately exhaust local memory space.
[0040] Here, the threshold can be set to one-fifth or one-quarter of the local memory space, or other threshold sizes. The threshold size can be set as needed; this is merely an example and does not constitute a limitation on the scope of the claims.
[0041] S40, if the local memory space is not higher than the threshold, allocate page tables from the reserved page table allocation memory pool in the local memory.
[0042] For example, if the amount of free local memory is detected to be less than a threshold, it indicates that the amount of free local memory is relatively small. If page table allocation continues to be performed in the manner of allocating page tables from the operating system's memory allocator, local memory will be quickly exhausted, leading to inaccurate stress test results or even preventing the stress test from being performed. Since this embodiment sets up a page table allocation pool in local memory, when the amount of free local memory is detected to be less than the threshold, page table allocation can be performed from the reserved page table allocation pool in local memory, thus ensuring the successful execution of memory allocation operations.
[0043] In some embodiments, the memory resources of the page table allocated memory pool are uniquely obtained from local memory, and the page table allocated memory pool has independent memory nodes corresponding to the number of server paths.
[0044] For example, this embodiment uses a dual-socket server equipped with CXL heterogeneous memory as an example. The server includes two independent physical CPUs, CPU1 and CPU2. CPU1 is directly connected to local DDR1 memory and external CXL1 remote memory, while CPU2 is directly connected to local DDR2 memory and external CXL2 remote memory, forming a heterogeneous topology with dual local DDR and dual CXL remote memory. Based on the above hardware topology, the operating system can construct an independent page table memory pool corresponding one-to-one with the number of CPUs.
[0045] All memory resources in the page table memory pool are drawn solely from the local DDR memory directly connected to the CPU, without occupying or using any CXL remote memory. The number of page table memory pools is consistent with the number of server CPU paths, with each CPU path bound to its own independent page table memory pool, achieving isolated allocation and independent management of page table resources for the two CPU paths.
[0046] This embodiment is based on a detailed description of a customized dual-path four-node topology and is adapted to the CXL 1LM volatile memory mode. Of course, it is understood that this embodiment can also be extended to four-path and above heterogeneous memory servers.
[0047] This server forms four independent NUMA memory nodes, with the following mapping example: DDR1 directly connected to CPU1 is mapped to Node0, and CXL1 remote memory external to CPU1 is mapped to Node2; DDR2 directly connected to CPU2 is mapped to Node1, and CXL2 remote memory external to CPU2 is mapped to Node3. Node0 and Node1 are high-speed local DDR memory nodes bound to their respective CPU cores; Node2 and Node3 are low-speed CXL remote memory nodes without CPU binding, used only for large-capacity memory expansion and not carrying critical kernel metadata. Figure 5 The number of nodes is related to the number of CPUs. Figure 5The node #N shown represents Node #N, where N is a positive integer greater than 1.
[0048] After the server powers on and initializes, it can report the affinity between each memory node and the CPU through the System Resource Affinity Table (SRAT), distinguish the bandwidth and latency differences between local DDR and remote CXL memory through the HMAT table, and identify CXL1 and CXL2 as 1LM Vol volatile memory modes through the heterogeneous memory attribute table. After the operating system parses the ACPI data table, it can accurately identify the hierarchical topology of local high-speed memory and remote low-speed memory.
[0049] The operating system memory allocator establishes hierarchical isolation rules, restricting latency-sensitive kernel metadata such as page tables, allowing allocation only from local DDR memory on Node0 and Node1, and strictly prohibiting allocation to remote CXL memory on Node2 and Node3, thus implementing local allocation constraints for page table resources from the underlying layer.
[0050] Based on a dual-CPU architecture, this application creates a corresponding page table memory pool. The memory pool obtains resources only from the local DDR memory of the corresponding CPU. Resources corresponding to CPU1 are allocated, reserved, and reclaimed only from DDR1 of Node0, without using CXL1 memory of Node2; resources corresponding to CPU2 are allocated, reserved, and reclaimed only from DDR2 of Node1, without using CXL2 memory of Node3, thus avoiding remote memory from participating in page table storage and allocation.
[0051] In high-load scenarios such as memory stress testing, massive process concurrency, and large memory expansion, the page table memory pool design provided in this application can quickly allocate page table memory in batches, avoid system memory fragmentation, and at the same time, page table resources only occupy local memory bandwidth, releasing remote bandwidth resources of CXL1 and CXL2, which greatly improves the utilization rate of heterogeneous memory resources and hierarchical scheduling efficiency.
[0052] In some embodiments, the method further includes, If the local memory space is not higher than the threshold, the operating system is prohibited from starting the memory overflow termination mechanism.
[0053] For example, the system can detect the remaining local memory space in real time and preset a fixed local memory free threshold. That is, by monitoring the server's local memory free capacity in real time, when the local memory space is not higher than the preset threshold, the system forcibly prevents the operating system from starting the memory overflow termination mechanism, avoiding the system mistakenly killing business processes and causing abnormal crashes. For example, the system pre-configures the local memory free threshold to one-fifth. This threshold is the minimum safe memory capacity adapted to the system kernel operation and the page table memory pool resident state. The threshold value can be flexibly configured according to the server hardware specifications and business scenarios. When the remote memory still meets the preset availability conditions, the forced prevention of the operating system from starting the memory overflow termination mechanism can be a delayed triggering of the memory overflow termination mechanism, and the delayed state is lifted after the local memory free capacity recovers to the preset recovery threshold. When the local memory is reclaimed by the kernel and resources are released, and the free space recovers to above the preset threshold, the lock is automatically released, restoring the normal triggering capability of the operating system's memory overflow termination mechanism, ensuring the system's basic protection capability under extreme memory exhaustion scenarios.
[0054] By finely controlling local memory thresholds and disabling the memory overflow termination mechanism in scenarios with low local memory availability, the problem of the system misjudging memory overflow and arbitrarily terminating core business processes in heterogeneous memory scenarios with tight local memory and sufficient remote memory can be effectively avoided. This balances the business operation stability of heterogeneous memory servers with the system's memory security protection capabilities.
[0055] In some embodiments, the method further includes, When the space in the local memory corresponding to the page table-allocated memory pool is used, and there are available resources in the local memory that meet preset retention conditions, the page table-allocated memory pool is replenished from the local memory. Furthermore, memory can be forcibly replenished from the local memory to the page table-allocated memory pool to refill the page table-allocated memory pool resources.
[0056] For example, as described above, this application embodiment is applied to a server system with local DDR memory and CXL remote heterogeneous memory. The system is configured with a dedicated page table allocation memory pool, and the resources of the page table allocation memory pool are only taken from the server's local DDR memory. The system presets a local memory idle threshold, for example, set to 1 / 5 of the total local DDR capacity, to ensure a basic safety margin for kernel page table services and to enable automatic replenishment and maintenance of the page table memory pool in low local memory scenarios. The local DDR memory idle threshold is pre-configured with 1 / 5 of the total local DDR capacity as the critical threshold. This threshold is the minimum safe memory margin to maintain the normal operation of the page table memory pool. When both conditions are met simultaneously—local DDR remaining space is less than the preset 1 / 5 threshold and the reserved space of the page table allocation memory pool is exhausted—the system prohibits calling any CXL remote memory resources to replenish the page table memory, and only uses the free space within the threshold range of the remaining DDR to complete the page table memory pool refill.
[0057] Combined again Figure 5 The refilling process adapts to two allocation modes based on the kernel's operating scenario: Normal thread contexts use the NO_FAIL (no-failure allocation mode) allocation method. During the allocation process, the kernel is allowed to reclaim memory and wait for idle resources, ensuring that the page table memory replenishment will ultimately succeed, without returning allocation failure or blocking business execution. When the page table pool is refilled, every effort is made to reclaim remaining local DDR memory to ensure successful pool replenishment and maintain emergency availability.
[0058] Interrupt contexts employ an ATOMIC (atomic allocation mode) non-sleep allocation method. The allocation process does not involve sleeping, waiting, or triggering memory reclamation, completing memory allocation atomically and quickly. This enables rapid emergency memory replenishment and ensures that page table memory resources originate solely from local DDR throughout the entire process.
[0059] After refilling is completed, the system continuously monitors the local memory balance and the page table memory pool usage status in a loop, dynamically maintaining the resource integrity of the page table memory pool to prevent page table resources from being used up or occupying remote memory.
[0060] In scenarios with low local memory availability, the page table memory pool is automatically refilled using remaining local memory resources, ensuring that page table resources are always configured entirely locally and avoiding the problem of allocating page tables to low-speed CXL remote memory. This effectively solves problems such as increased address translation latency and decreased system stability caused by local memory shortages and page table pool exhaustion, ensuring the stability of kernel memory management and business operations on heterogeneous memory servers.
[0061] In some embodiments, the method further includes, If memory is successfully replenished from local memory, the emergency availability of the page table-allocated memory pool will continue to be maintained. If the attempt to add memory fails, a memory allocation error will be reported to the operating system.
[0062] For example, the system checks the result of this local memory replenishment operation. If the local memory replenishment of page table resources is successful, the page table allocation memory pool remains in an emergency available state to ensure the normal and stable operation of the system's virtual-to-physical address translation service. If insufficient local memory resources cause the replenishment to fail, the system immediately reports the memory allocation error information to the operating system kernel, triggering the kernel's established exception handling logic to prevent system failure caused by missing page table resources.
[0063] After completing a single refill and result processing, the system continuously monitors the local memory balance and the page table memory pool occupancy status in a loop, dynamically maintaining the resource integrity of the page table memory pool.
[0064] In some embodiments, the method further includes, If the local memory space is not lower than the threshold, then page table memory is allocated according to the operating system's native memory allocation mechanism.
[0065] For example, this embodiment addresses scenarios with ample local memory, implementing routine allocation and management of page table memory. Continuing with the 1 / 5 threshold as an example, when the remaining free space in the local DDR memory is not less than the preset 1 / 5 threshold, local memory resources are deemed sufficient, and there is no need to activate the emergency mechanism for forced refilling of the page table memory pool. At this time, the system fully follows the operating system's native memory allocation mechanism, directly requesting and allocating page table memory through the operating system's memory allocator, providing page table resource support for the system's virtual-to-physical address translation. During the allocation process, the constraint that page table memory is only obtained from local DDR memory is maintained, and it does not occupy CXL remote memory resources.
[0066] In scenarios with ample local memory, the operating system's native memory allocation logic can be reused, eliminating the need for additional memory pool refill operations, reducing system kernel overhead, and ensuring continuous local allocation of page table memory, thus balancing system operating efficiency and the stability of heterogeneous memory architecture.
[0067] In some embodiments, the method further includes, After completing the page table memory allocation, return the memory address of the allocated page table to confirm the successful execution of the page table allocation operation.
[0068] For example, after the system completes the allocation of page table memory resources, the kernel records the physical memory address corresponding to the successfully allocated page table memory in real time. The kernel returns this valid page table memory address as a return value to the upper-layer kernel scheduling module, completing a single page table allocation process.
[0069] Based on the returned page table memory address, the upper-layer module completes subsequent operations such as establishing the virtual-to-physical address mapping, mounting the page table, and translating the memory address to ensure normal access to the process's address space. If the page table memory allocation fails, it returns the corresponding exception address information for the kernel to handle.
[0070] After the page table allocation is completed, the corresponding memory address is accurately returned, realizing a closed loop in the page table resource allocation and address mapping process. This ensures accurate and reliable system address space management, adapts to all scenarios of regular native allocation and emergency memory pool refilling, and improves kernel memory management performance.
[0071] In some embodiments, the method further includes, The response to the page table memory allocation request follows the principle that page table memory is allocated only from local memory-related resources, and the page table memory is determined according to traversal rules.
[0072] For example, when the operating system receives a page table memory allocation request, the kernel executes a preset page table memory traversal matching rule. The traversal process only traverses the local memory node resources corresponding to each CPU of the server. Taking the CPUs mentioned above, including CPU1 and CPU2, as an example, it traverses the local memory of Node0 corresponding to CPU1 and the local memory of Node1 corresponding to CPU2, skipping and not traversing the CXL remote memory resources corresponding to Node2 and Node3.
[0073] The kernel sequentially traverses free memory blocks within the local memory resource scope, matches memory resources that conform to the page table allocation specifications, and completes the request and allocation of page table memory. Page table memory is only taken from the local memory allocation principle to avoid remote memory from participating in page table resource allocation.
[0074] By limiting the traversal range of page table memory allocation, the local allocation of page table resources is constrained from the retrieval source, avoiding the allocation of page table memory to low-speed CXL remote memory, ensuring low latency and high stability in the address translation process, and adapting to the page table management needs of multi-path heterogeneous memory servers.
[0075] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method described in any of the above embodiments.
[0076] The computer storage medium of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, system, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access storage medium (RAM), a read-only storage medium (ROM), an erasable programmable read-only storage medium (EPROM or flash memory), an optical fiber, a portable compact disk read-only storage medium (CD-ROM), an optical storage medium, a magnetic storage medium, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, antenna, optical fiber, RF, etc., or any suitable combination thereof.
[0077] Furthermore, those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0078] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction set implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0079] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0080] This application also provides an electronic device, combined with... Figure 6 The electronic device includes a processor and a memory, the processor being used to perform: Check whether the server running the operating system has remote memory.
[0081] For example, the firmware uses ACPI (Advanced Configuration and Power Interface) to write hardware information such as CPU, memory, CXL, and NUMA topology into standardized tables. The operating system reads these tables to identify and schedule the hardware. When the operating system boots up, it can scan all hardware and use these tables to identify whether the server running the operating system has remote memory CXL.
[0082] When remote memory is available, the space corresponding to the memory pool is allocated from the page table set in local memory.
[0083] For example, in the case of a server running an operating system with remote memory, it can be determined that the server in this application, in addition to local memory, also has remote memory connected to the CPU. In this embodiment, the operating system running on the server can be in 1LM Vol mode with independent NUMA nodes. In this case, space corresponding to the page table allocation memory pool is reserved from the local DDR memory directly connected to the CPU. Here, the page table allocation memory pool is a contiguous memory buffer pre-reserved by the kernel in physical memory specifically for storing page tables at various levels (e.g., PML4E), and is uniformly managed by the operating system memory allocator. The page table allocation memory pool physically separates the memory required for page tables from the CXL remote memory, preventing allocation to remote CXL nodes. This forces the entire page table allocation memory pool to reside in local DDR, avoiding page tables residing in CXL remote memory.
[0084] When the server has CXL remote memory, allocating the memory pool space corresponding to the page table from local memory can eliminate cross-node access for address translation. For each virtual address access, the CPU must first read the page table to complete the virtual-to-physical address translation. If the page table is located in CXL remote memory, every memory access will trigger a cross-NUMA node CXL link read, resulting in significantly increased latency, frequent cache invalidation, and other problems that severely impact server performance. Allocating the memory pool space corresponding to the page table from local memory, with its dedicated DDR page table allocation pool, ensures that all page table physical addresses are located locally, and address translation is entirely local access, without the involvement of CXL links.
[0085] Taking the scenario of using a memory stress testing tool to perform operating system memory stress testing as an example, during memory stress testing, massive memory allocation across the entire machine generates a huge number of page tables. Without a local page table allocation pool, page tables are randomly allocated to CXL, amplifying the load through cross-node read / write operations, resulting in numerous machine check anomalies and latency issues during testing. However, the embodiment of this application deploys a dedicated local page table allocation pool, where page table allocation converges to the local DDR. The stress test results accurately reflect memory performance, are accurate and controllable, and improve the stability of the overall machine memory stress test.
[0086] In response to a page table memory allocation request, determine whether the local memory space is not lower than the threshold.
[0087] For example, when data needs to be read / stored, a page table memory allocation request is generated. In response to this request, a page table is allocated from local memory. As page table allocation proceeds, local memory space decreases. Therefore, during page table allocation, the amount of free local memory can be detected. If a significant amount of free local memory is detected, a page table can be allocated from the operating system's memory allocator using the normal page table allocation method, which will not immediately exhaust local memory space.
[0088] Here, the threshold can be set to one-fifth or one-quarter of the local memory space, or other threshold sizes. The threshold size can be set as needed; this is merely an example and does not constitute a limitation on the scope of the claims.
[0089] If the local memory space is not higher than the threshold, page table allocation is performed from the reserved page table allocation memory pool in the local memory.
[0090] For example, if the amount of free local memory is detected to be less than a threshold, it indicates that the amount of free local memory is relatively small. If page table allocation continues to be performed in the manner of allocating page tables from the operating system's memory allocator, local memory will be quickly exhausted, leading to inaccurate stress test results or even preventing the stress test from being performed. Since this embodiment sets up a page table allocation pool in local memory, when the amount of free local memory is detected to be less than the threshold, page table allocation can be performed from the reserved page table allocation pool in local memory, thus ensuring the successful execution of memory allocation operations.
[0091] The foregoing has described in detail several embodiments of this application, but this application is not limited to these specific embodiments. Those skilled in the art can make various variations and modifications based on the concept of this application, and all such variations and modifications should fall within the scope of protection claimed in this application.
Claims
1. A page table memory allocation method, the method comprising: Check whether the server running the operating system has remote memory; When remote memory is available, the space corresponding to the memory pool is allocated from the page table of the local memory. In response to a page table memory allocation request, determine whether the local memory space is not lower than the threshold. If the local memory space is not higher than the threshold, page table allocation is performed from the reserved page table allocation memory pool in the local memory.
2. The method according to claim 1, wherein the memory resources of the page table allocated memory pool are uniquely obtained from local memory, and the page table allocated memory pool has independent memory nodes corresponding to the number of server paths.
3. The method according to claim 1, further comprising: If the local memory space is not higher than the threshold, the operating system is prohibited from starting the memory overflow termination mechanism.
4. The method according to claim 1, further comprising: When the space in the local memory corresponding to the page table allocated memory pool is used, memory is forcibly added from the local memory to the page table allocated memory pool to refill the page table allocated memory pool resources.
5. The method according to claim 4, further comprising: If memory is successfully replenished from local memory, the emergency availability of the page table-allocated memory pool will continue to be maintained. If the attempt to add memory fails, a memory allocation error will be reported to the operating system.
6. The method according to claim 1, further comprising: If the local memory space is not lower than the threshold, then page table memory is allocated according to the operating system's native memory allocation mechanism.
7. The method according to claim 1, further comprising: After completing the page table memory allocation, return the memory address of the allocated page table to confirm the successful execution of the page table allocation operation.
8. The method according to claim 1, further comprising: The response to the page table memory allocation request follows the principle that page table memory is allocated only from local memory-related resources, and the determination of page table memory follows traversal rules.
9. A computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the method as described in any one of claims 1-8.
10. An electronic device comprising a processor and a memory, the processor being configured to perform: Check whether the server running the operating system has remote memory; When remote memory is available, the space corresponding to the memory pool is allocated from the page table of the local memory. In response to a page table memory allocation request, determine whether the local memory space is not lower than the threshold. If the local memory space is not higher than the threshold, page table allocation is performed from the reserved page table allocation memory pool in the local memory.