Memory data processing method and device of multi-core system and multi-core system

By using local variables to record the release progress in a multi-core system and updating the global variables when appropriate, the frequent atomic operations caused by excessive virtual memory areas are solved, and system performance and stability are improved.

CN120216403APending Publication Date: 2025-06-27LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510344590.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

In multi-core systems, when the virtual memory area is too long, frequent atomic operations will cause a significant increase in execution time, which may cause soft lock or hard lock errors.

Method used

Update the global variables by using local variables during the virtual memory page release process, and sending local variables for atomic operations when specific conditions are met to reduce the frequency of atomic operations.

Benefits of technology

It reduces the frequency of atomic operations, reduces the execution time and the incidence of locking errors in multi-core systems, and improves the system's response speed and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216403A_ABST
    Figure CN120216403A_ABST
Patent Text Reader

Abstract

The invention discloses a memory data processing method and device of a multi-core system and the multi-core system.The method comprises the steps that in the process of releasing a virtual memory page, a local variable sent by a first core is obtained; wherein the local variable is private data of a corresponding first core in the multi-core system and is used for recording a first metering parameter of a release progress of a to-be-released virtual memory page corresponding to the first core, and when the release progress meets a first condition, the first core sends the local variable; the atomic operation is executed, and the global variable is updated, so that the updated global variable is matched with the release progress of the first core; the global variable is data shared by each core in the multi-core system and is used for recording second metering parameters of all virtual memory pages needing to be released in the memory in the multi-core system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data processing, and more specifically, to a method and apparatus for processing memory data in a multi-core system and a multi-core system. Background Art

[0002] A virtual memory area (VMA) describes a continuous area in a process's virtual address space and is used in scenarios such as memory mapping, dynamic memory allocation, and memory reclamation. In an operating system, virtual memory management is performed in units of virtual memory pages, called paging management. When certain virtual memory pages are no longer in use, these virtual memory pages can be released, reclaimed, and cleared.

[0003] In a multi-core system, virtual memory management records the number of allocated virtual memory pages through virtual memory areas and uses a global variable to record the number of pages to be reclaimed. When multiple cores operate on shared data simultaneously, atomic operations are required to ensure data consistency. However, when the virtual memory area is too long, frequent atomic operations can cause a significant increase in execution time. The cache locking mechanism of atomic operations may prevent other cores from accessing shared data, thereby causing the operating system to report soft lock or hard lock errors. Summary of the Invention

[0004] In view of this, the present application provides the following technical solutions:

[0005] A method for processing memory data in a multi-core system includes:

[0006] During the process of releasing virtual memory pages, obtain a local variable sent by a first core; wherein, the local variable is private data of the corresponding first core in the multi-core system and is used to record a first measurement parameter of the release progress of the virtual memory pages to be released corresponding to the first core, and when the release progress meets a first condition, the first core sends the local variable;

[0007] Perform an atomic operation to update a global variable so that the updated global variable matches the release progress of the first core; the global variable is data shared by each core in the multi-core system and is used to record a second measurement parameter of all virtual memory pages in the memory of the multi-core system that need to be released.

[0008] Optionally, it further includes:

[0009] When the first core traverses the virtual memory area, update the local variable corresponding to the first core based on the traversal result; wherein, the virtual memory area includes at least one virtual memory page; the traversal result represents the result of the first core traversing the first number of virtual memory areas.

[0010] Optionally, the first core corresponds to at least one virtual memory area, and when the first core traverses the virtual memory area, updating the local variable corresponding to the first core based on the traversal result includes:

[0011] During the process of the first core traversing the virtual memory pages in the first virtual memory area one by one, update the local variable corresponding to the first core based on the first quantity value of the virtual memory pages to be released in the first virtual memory area, wherein, after traversing the first virtual memory area, the first measurement parameter recorded in the updated local variable is the first quantity value;

[0012] During the process of the first core continuing to traverse the virtual memory pages in the second virtual memory area one by one, update the local variable corresponding to the first core based on the second quantity value of the virtual memory pages to be released in the second virtual memory area; wherein, after traversing the second virtual memory area, the first measurement parameter recorded in the updated local variable is the sum value of the first quantity value and the second quantity value; the second virtual memory area has a target traversal order with the first virtual memory area;

[0013] Until the first core completes the traversal of the virtual memory pages of each of the virtual memory areas corresponding to it, update the local variable corresponding to the first core, wherein, after completing the traversal of each virtual memory area, the first measurement parameter recorded in the updated local variable is the sum of the quantities of the virtual memory pages to be released corresponding to each virtual memory area.

[0014] Optionally, the local variable corresponding to the first core is set in the private storage area corresponding to the first core, and the initial value of the local variable is 0.

[0015] Optionally, when the release progress meets the first condition, the first core sends the local variable, including:

[0016] When the quantity of the virtual memory pages released corresponding to the release progress meets the second quantity, the first core sends the local variable.

[0017] Optionally, updating the global variable includes:

[0018] Perform an atomic operation to update the second measurement parameter recorded in the global variable to the third measurement parameter, where the third measurement parameter is the difference between the second measurement parameter and the first measurement parameter.

[0019] Optionally, the performing the atomic operation to update the global variable includes:

[0020] After the first core completes the update of its corresponding local variable, perform an atomic operation to update the global variable;

[0021] Or, after the target number of cores in the multi-core system complete the update processing of their corresponding local variables, perform an atomic operation to update the local variable.

[0022] A memory data processing device for a multi-core system, including:

[0023] An acquisition unit, configured to obtain a local variable sent by the first core during the process of releasing a virtual memory page; wherein, the local variable is private data of the corresponding first core in the multi-core system, and is used to record a first measurement parameter of the release progress of the virtual memory page to be released corresponding to the first core, and when the release progress meets the first condition, the first core sends the local variable;

[0024] An execution unit, configured to perform an atomic operation to update the global variable, so that the updated global variable matches the release progress of the first core; the global variable is data shared by each core in the multi-core system, and is used to record a second measurement parameter of all virtual memory pages in the memory of the multi-core system that need to be released.

[0025] A multi-core system, the multi-core system includes at least a first core; the first core includes:

[0026] A memory, configured to store an application program and data generated by the running of the application program;

[0027] A processor, configured to execute the application program to implement:

[0028] During the process of releasing a virtual memory page, obtain a local variable sent by the first core; wherein, the local variable is private data of the corresponding first core in the multi-core system, and is used to record a first measurement parameter of the release progress of the virtual memory page to be released corresponding to the first core, and when the release progress meets the first condition, the first core sends the local variable;

[0029] Perform an atomic operation to update a global variable so that the updated global variable matches the release progress of the first core; the global variable is data shared by each core in the multi-core system and is used to record a second measurement parameter of all virtual memory pages in the memory of the multi-core system that need to be released.

[0030] Optionally, the first core further includes a private storage module, and the local variable is configured in the private storage module. Description of the Drawings

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.

[0032] Figure 1 It is a schematic flowchart of a method for processing memory data of a multi-core system provided by an embodiment of the present application;

[0033] Figure 2 It is a schematic diagram of a scenario for updating a local variable provided by an embodiment of the present application;

[0034] Figure 3 It is a schematic diagram of a scenario for updating a global variable provided by an embodiment of the present application;

[0035] Figure 4 It is a schematic structural diagram of a device for processing memory data of a multi-core system provided by an embodiment of the present application;

[0036] Figure 5 It is a schematic structural diagram of a multi-core system provided by an embodiment of the present application. Detailed Embodiments

[0037] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0038] The terms "first" and "second" in the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may include steps or units not listed.

[0039] An embodiment of the present application provides a method for processing memory data in a multi-core system. This method is applied to a multi-core system, which may refer to a processor chip inside an electronic device that integrates multiple independent processing cores. These cores can execute multiple threads or programs simultaneously, thereby improving the overall performance and parallel processing ability of the system. Correspondingly, the multi-core system may also refer to a processing device including multiple processors, or a processing system including multiple processing devices, etc. In application scenarios, the multi-core system can be a computer, a server, a mobile device, or an embedded system. The method for processing memory data in this multi-core system can optimize the execution of atomic operations, reduce the usage frequency of atomic operations, and improve the overall response speed and stability of the multi-core system.

[0040] To facilitate the description of the embodiments of the present application, relevant terms will be explained below.

[0041] Atomic operation: It refers to an operation that cannot be interrupted during execution and can be regarded as an indivisible unit without being interrupted by other operations in the middle. In a multi-threaded environment, multiple threads may access and modify shared resources simultaneously. Atomic operations can ensure data consistency. Atomic operations are often used to implement locks (such as spin locks, mutex locks) and synchronization mechanisms (such as semaphores, condition variables) to ensure thread safety.

[0042] Virtual memory page: It can be the smallest unit of virtual memory management. The operating system divides the virtual address space of a program into fixed-size blocks, and these blocks are called "pages". Its function can be to map the pages in the virtual address space to the page frames in the physical address space, or store them in the swap space on the disk.

[0043] Virtual memory area (virtual_area): It can be used to describe a continuous area of the virtual address space of a process. The size of this area is usually in units of virtual memory pages and can be used in scenarios such as memory mapping, dynamic memory allocation, and memory recycling.

[0044] See Figure 1 , which is a schematic flowchart of a method for processing memory data in a multi-core system provided by an embodiment of the present application. This method may include the following steps:

[0045] S101. During the process of releasing a virtual memory page, obtain a local variable sent by the first core.

[0046] S102. Execute an atomic operation to update a global variable.

[0047] In the embodiments of the present application, the multi-core system includes at least one core. For example, the multi-core system may include a first core and at least one other core. The method is applied to the scenario of processing memory data. Physical memory is the actual hardware memory in the multi-core system, providing storage space for the operating system and running programs. The virtual memory page is the basic unit of virtual memory management, used to divide the virtual memory space into fixed-size blocks and perform data exchange and management between the physical memory and the hardware. The operating system can release and recycle virtual memory pages through the memory management mode to optimize the virtual memory capacity.

[0048] In step S101 of the embodiments of the present application, during the process of releasing virtual memory pages, that is, when recycling virtual memory pages, a local variable sent by the first core can be obtained. The first core is the core currently executing memory data processing in the multi-core system, which can represent any core in the multi-core system or a core with a higher processing priority in the multi-core system. In order to reduce the atomic operation steps executed during the release and recycling of virtual memory pages, in the embodiments of the present application, the first core does not directly record the measurement parameter corresponding to the release progress of the virtual memory page to be released into the global variable through an atomic operation, but first records it in the local variable corresponding to the first core. The local variable is the private data of the corresponding first core in the multi-core system, used to record the first measurement parameter of the release progress of the virtual memory page to be released corresponding to the first core. The virtual memory page to be released can be the memory page that needs to be released for the release of the virtual memory page currently executed by the first core. The release progress represents the progress of the virtual memory page being released, which can represent the progress of all the virtual memory pages to be released corresponding to the first core being released, or the progress of the released virtual memory pages reaching a specified quantity. In order to reduce the frequency of atomic operations, in the embodiments of the present application, the first core records the measurement parameter of the release and progress of the virtual memory page to be released in the local variable, and the first core can update the local variable after the virtual memory page to be released is released. Then, according to step S102, an atomic operation can be executed to update the global variable.

[0049] During the process of updating the global variable, it is necessary to update the global variable based on the local variable in step S101. If in step S101, each time the first core updates the local variable, it sends the local variable and performs an atomic operation to update the global variable, it will not reduce the frequency of atomic operations and will also degrade the performance of the multi-core system. Therefore, in the embodiment of the present application, when the release progress meets the first condition, the first core will send the local variable. Among them, when the release progress meets the first condition, it can be that all the virtual memory pages to be released corresponding to the first core are completely released, or it can be that a specified number of the memory pages to be released corresponding to the first core are released. In this way, when the release progress meets the first condition, the first core sends the local variable. Then, an atomic operation is performed to update the global variable so that the updated global variable matches the release progress of the first core. Among them, the global variable is data shared by each core in the multi-core system and is used to record the second measurement parameter of all the virtual memory pages that need to be released in the multi-core system.

[0050] For example, if the number of virtual memory pages to be released by the first core is 20, when the release progress indicates that 15 of the virtual memory pages to be released by the first core have been released, the local variable can be updated to 15, and then this value is sent to the corresponding thread that performs the atomic operation. This thread updates the global variable based on the parameter of 15 recorded in this local variable. For example, if the initial value of the global variable is the number of all virtual memory pages to be released, which is 40, at this time, it is updated to 25 based on this local variable. In this way, compared with the processing process of performing an atomic operation every time the local variable is updated, the frequency of performing atomic operations can be reduced, and there is no need to perform synchronization operations (such as: spin locks, mutex locks, or atomic operation mechanisms), improving the performance of the system.

[0051] During the process of releasing virtual memory pages, the first core can update the local variable during the process of traversing the virtual memory pages according to the virtual memory management mode. For example, in the case where the first core traverses the virtual memory area, the local variable corresponding to the first core is updated based on the traversal result. Among them, the virtual memory area includes at least one virtual memory page, and the traversal result represents the result of the first core traversing the first number of virtual memory areas.

[0052] When the first core traverses the virtual memory area, it can be that the first core reads the data structure used to represent the virtual memory area in the virtual memory area to achieve traversal. For example, use the virtual_area to represent the data structure of the virtual memory area, and record information such as the start address, end address, and permissions of each virtual memory area. Thus, the information of the corresponding virtual memory page can be obtained according to this data structure. Further, the number of virtual memory pages included in the virtual memory area can be represented by the "nr_pages" field. When the operating system of the first core traverses the "virtual_area" list, it will use the "nr_pages" field to count the number of virtual memory pages that can be released and recycled, and then record these numbers into local variables. Correspondingly, the first core can record the number of all obtained releasable virtual memory pages into local variables after traversing each virtual memory area; it can also be that the first core records the number of obtained releasable virtual memory pages into local variables after traversing the first quantity of virtual memory areas. Among them, the first quantity can be determined according to the current application scenario, or determined according to the task requirements of the memory release task of the first core. For example, the first quantity can refer to one, or it can refer to multiple quantity values. When the first quantity is one, it means that the first core will update the local variable every time it traverses a virtual memory area. When the first quantity is a specified quantity, it means that the first core updates the local variable after traversing the specified quantity of virtual memory areas.

[0053] For example, the operating system maintains a data structure (such as a virtual_area list) to record which virtual memory pages can be released. Each virtual_area structure usually contains the following information:

[0054] Start address: The start address of the memory area.

[0055] End address: The end address of the memory area.

[0056] Number of pages (nr_pages): The number of virtual memory pages included in this virtual memory area.

[0057] Status: Mark whether this virtual memory area can be released.

[0058] Then, when the first core traverses the virtual_area list, the system checks the status of each virtual_area: if a certain virtual_area is no longer in use (for example, the process has released this memory area), it is marked as "recyclable" (or "releasable"). Add the number of pages (nr_pages) of this virtual_area to the number of pages that have been recycled and record it in the local variable.

[0059] In an implementation manner of the embodiment of the present application, the measurement parameter recorded by the local variable is updated in an accumulative increase manner. The first core corresponds to at least one virtual memory area. Wherein, when the first core traverses the virtual memory area, the local variable corresponding to the first core is updated based on the traversal result, including: during the process of the first core traversing the virtual memory pages in the first virtual memory area one by one, based on the first quantity value of the virtual memory pages to be released in the first virtual memory area, updating the local variable corresponding to the first core; wherein, the first measurement parameter of the updated local variable corresponding to the first core after traversing the first virtual memory area is the first quantity value. During the process of the first core continuing to traverse the virtual memory pages in the second virtual memory area one by one, based on the second quantity value of the virtual memory pages to be released in the second virtual memory area, updating the local variable corresponding to the first core; wherein, the second virtual memory area and the first virtual memory area have a target traversal order; the first measurement parameter of the updated local variable recorded after traversing the second virtual memory area is the sum of the first quantity value and the second quantity value. Until the first core completes the traversal of the virtual memory pages of each virtual memory area corresponding to it, the local variable corresponding to the first core is updated. Wherein, the first measurement parameter of the updated local variable after completing the traversal of each virtual memory area is the sum of the quantities of the virtual memory pages to be released corresponding to each virtual memory area.

[0060] In this implementation manner, according to the traversal order of the virtual memory area, the numerical value corresponding to the quantity of the virtual memory pages to be released in each virtual memory area is accumulated and recorded in the local variable. The local variable corresponding to the first core is set in the private storage area corresponding to the first core, and the initial value of the local variable is 0, so that the quantity values of the virtual memory pages to be released corresponding to each virtual memory area can be accumulated and recorded in the local variable based on the initial value, and the first measurement parameter recorded by it can be obtained.

[0061] Illustrated by way of example, refer to Figure 2 , which shows a schematic diagram of a scenario for updating a local variable provided in the embodiment of the present application. In Figure 2 , the first core corresponds to a plurality of virtual memory areas (in Figure 2 , the data structure of the virtual memory area is represented by virtual_area), and each virtual memory area further includes a nr_pages field, which represents the number of virtual memory pages included in the virtual memory area. In Figure 2The virtual memory area shown also includes a "list" field, which represents a list. That is, by connecting the virtual_area structures through the list, the operating system can efficiently manage the virtual memory space of the process, ensuring the reasonable allocation and recycling of memory resources. In Figure 2 a local variable is set in the private storage area corresponding to the first core. The number of virtual memory pages that have been released is recorded in this local variable through the field "local_purge_pages". Correspondingly, its initial value can be 0. For example, in Figure 2 the scenario shown, when the first core traverses the virtual memory area from left to right, if the number of virtual memory pages recorded by the nr_pages field in the leftmost virtual memory area is 5 and all of them can be released, the number of virtual memory pages to be released is 5. At this time, the field value local_purge_pages of the local variable can be updated to 5. Then, traverse the second virtual memory area, where nr_pages = 2. If all of them can be released, the number of virtual memory pages to be released corresponding to this second virtual memory area is 2. At this time, the field value local_purge_pages corresponding to the local variable will be updated to 7. Then continue to traverse the third virtual memory area, where nr_pages = 9. If all of them can be released, the number of virtual memory pages to be released corresponding to this third virtual memory area is 9. At this time, the field value local_purge_pages corresponding to the local variable will be updated to 16. Until traversing to the last virtual memory area on the right, the number of virtual memory pages to be released corresponding to it is 6. At this time, the field value corresponding to the local variable will be updated to 30. Then, an atomic operation will be performed according to the value of this local variable to update the global variable. It can be seen that in this way, the first core does not have to perform an atomic operation every time it traverses a virtual memory area to update the global variable. Instead, after the traversal is completed, an atomic operation is performed to update the global variable according to the value in the local variable. Thus, the number of atomic operations can be reduced, improving the performance of the system.

[0062] In the embodiments of the present application, it may be that after the first core finishes traversing its corresponding virtual memory pages, an atomic operation is performed to update the global variable. Or it may be that when the number of released virtual memory pages obtained by the first core during traversal reaches the execution number, an atomic operation is performed to update the global variable. Correspondingly, in the embodiments of the present application, when the release progress meets the first condition, the first core sends local variables including: when the number of released virtual memory pages corresponding to the release progress meets the second number, the first core sends local variables. Wherein, the second number may be determined according to the current application scenario, or the number of virtual memory regions, and the total number of virtual memory pages to be released, etc. To reduce the number of atomic operations, the second number may be set to a relatively large value.

[0063] The global variable may be set in the shared storage area of the multi-core system, and the initial value of the global variable may be the total number of all virtual memory pages in the multi-core system that need to be released. Then, the value recorded by the global variable is updated according to the local variable. In one implementation manner, performing an atomic operation to update the global variable includes: performing an atomic operation to update the second measurement parameter recorded by the global variable to a third measurement parameter, where the third measurement parameter is the difference between the second measurement parameter and the first measurement parameter. In this implementation manner, the second measurement parameter represents the initial value corresponding to the global variable, that is, the total number of all virtual memory pages in the multi-core system that need to be released. For example, if the second measurement parameter is 30 and the first measurement parameter recorded in the local variable is 20, then the third measurement parameter corresponding to the updated global variable is 30 - 20 = 10.

[0064] In the embodiments of the present application, performing an atomic operation to update the global variable may include: after the first core finishes updating its corresponding local variable, performing an atomic operation to update the global variable. It may also be that after the target number of cores in the multi-core system finish updating their corresponding local variables, an atomic operation is performed to update the local variable. In this implementation manner, it may be that after each core finishes traversing all its corresponding virtual memory pages and updates the local variable, then an atomic operation is performed. It may also be that when the number of cores in the multi-core system is relatively large, after the target number of cores finish updating their local variables, an atomic operation is performed to update the global variable. When performing the atomic operation in this way, it may be that after each core finishes updating the local variable, an atomic operation is performed to update the global variable. Or it may be that after several cores finish, an atomic operation is performed. In this scenario, it may be a scenario where there is a main core in the multi-core system, and through its execution of the atomic operation, it controls the update through the local variables of each core to improve the efficiency of updating the global variable.

[0065] See Figure 3, which shows a schematic diagram of a scenario for global variable update provided by an embodiment of the present application. A global variable is set in the shared storage area of a multi-core system (represented as "Global variable" in Figure 3 . The total number of virtual memory pages to be released is recorded in the global variable through the "nr_purge_pages" field, and then the value of this field can be updated according to the value recorded in the local quantity sent by the first core. For example, the recorded value of the local variable corresponding to the first core is 30, which means that the first core has released 30 virtual memory pages. If the initial value of the "nr_purge_pages" field of the global variable is 0, then according to the local variable, an atomic operation is performed to update the global variable, and the current recorded value of the global variable is obtained as 0 (i.e., 30 - 30 = 0).

[0066] In a multi-core system, when the release progress of the first core meets the first condition, the first core sends the local variable, and then performs an atomic operation to update the global variable so that the updated global variable matches the release progress of the first core. Further, after the first core has released the virtual memory pages, the global variable can also be updated by performing an atomic operation according to the local variable sent by the second core. In this way, the local variable is used to record the number of released virtual memory pages until the traversal of the virtual storage area list is completed, and then an atomic operation is performed once, that is, the global variable is updated. In this way, regardless of the list length, only one atomic operation needs to be performed, thus significantly improving the performance. Experiments have been carried out on multi-core systems with 72 cores, 192 cores, or 448 cores using this method, and their performance has been greatly improved.

[0067] An embodiment of the present application also provides a memory data processing device for a multi-core system. Refer to Figure 4 . The device includes:

[0068] An acquisition unit 401, configured to obtain the local variable sent by the first core during the process of releasing virtual memory pages; wherein, the local variable is private data of the corresponding first core in the multi-core system, and is used to record a first measurement parameter of the release progress of the virtual memory pages to be released corresponding to the first core. When the release progress meets the first condition, the first core sends the local variable;

[0069] An execution unit 402, configured to perform an atomic operation to update the global variable so that the updated global variable matches the release progress of the first core; the global variable is data shared by each core in the multi-core system and is used to record a second measurement parameter of all virtual memory pages in the memory of the multi-core system that need to be released.

[0070] Optionally, it further includes:

[0071] A first update unit, configured to update local variables corresponding to the first core based on a traversal result when the first core traverses a virtual memory area, where the virtual memory area includes at least one virtual memory page, and the traversal result represents a result of the first core traversing a first number of virtual memory areas.

[0072] Optionally, the first core corresponds to at least one virtual memory area, and the first update unit includes:

[0073] A first update subunit, configured to update local variables corresponding to the first core based on a first quantity value of virtual memory pages to be released in the first virtual memory area during a process of the first core traversing virtual memory pages in the first virtual memory area one by one, where a first measurement parameter recorded by the updated local variables corresponding to the first virtual memory area after traversing is the first quantity value;

[0074] A second update subunit, configured to update local variables corresponding to the first core based on a second quantity value of virtual memory pages to be released in the second virtual memory area during a process of the first core continuing to traverse virtual memory pages in the second virtual memory area one by one; where a first measurement parameter recorded by the updated local variables corresponding to the second virtual memory area after traversing is a sum value of the first quantity value and the second quantity value; the second virtual memory area and the first virtual memory area have a target traversal order;

[0075] A third update subunit, configured to update local variables corresponding to the first core until the first core completes traversing virtual memory pages of each of the corresponding virtual memory areas, where a first measurement parameter recorded by the updated local variables corresponding to completing traversing each of the virtual memory areas is a sum of the quantities of virtual memory pages to be released corresponding to each virtual memory area.

[0076] Optionally, local variables corresponding to the first core are set in a private storage area corresponding to the first core, and an initial value of the local variables is 0.

[0077] Optionally, when the release progress meets a first condition, the first core sends the local variables, including:

[0078] When the quantity of virtual memory pages released corresponding to the release progress meets a second quantity, the first core sends the local variables.

[0079] Optionally, the execution unit is specifically configured to:

[0080] Perform an atomic operation to update the second measurement parameter recorded in the global variable to the third measurement parameter, where the third measurement parameter is the difference between the second measurement parameter and the first measurement parameter.

[0081] Optionally, the execution unit includes:

[0082] A first execution subunit, configured to perform an atomic operation to update the global variable after the first core completes the update of its corresponding local variable;

[0083] Or, a second execution subunit, configured to perform an atomic operation to update the local variable after a target number of cores in the multi-core system complete the update processing of their corresponding local variables.

[0084] It should be noted that the specific implementation of each unit and subunit in this embodiment can refer to the corresponding content in the previous text, which will not be elaborated here.

[0085] In another embodiment of the present application, a readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the memory data processing method of the multi-core system as described above is implemented.

[0086] In another embodiment of the present application, a multi-core system is further provided. Refer to Figure 5 , this multi-core system may include a first core 501. Further, this multi-core system may further include a second core 502, a third core 503, etc. In Figure 5 only the first core 501, the second core 502, and the third core 503 included in the multi-core system are shown. In an actual application scenario, the number of cores matches the application requirements, and the embodiments of the present application do not limit this. Correspondingly, the first core 501 may include:

[0087] A memory 5011, configured to store an application program and data generated by the running of the application program;

[0088] A processor 5012, configured to execute the application program to implement:

[0089] During the process of releasing a virtual memory page, obtain the local variable sent by the first core; where the local variable is private data of the corresponding first core in the multi-core system, and is used to record a first measurement parameter of the release progress of the virtual memory page to be released corresponding to the first core. When the release progress meets the first condition, the first core sends the local variable;

[0090] Perform an atomic operation to update a global variable so that the updated global variable matches the release progress of the first core; the global variable is data shared by each core in the multi-core system and is used to record a second measurement parameter of all virtual memory pages in the memory of the multi-core system that need to be released.

[0091] Optionally, the first core further includes a private storage module, and the local variable is configured in the private storage module.

[0092] It should be noted that the specific implementation of the processor in this embodiment can refer to the corresponding content in the previous text and will not be elaborated here.

[0093] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.

[0094] Those skilled in the art can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0095] The steps of the methods or algorithms described in conjunction with the embodiments disclosed in this article can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0096] The above description of the disclosed embodiments enables those skilled in the art to implement or use this application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application will not be limited to the embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A memory data processing method for a multi-core system, comprising: In the process of releasing the virtual memory page, a local variable sent by the first core is obtained; wherein the local variable is private data of the first core corresponding to the multi-core system, and is used to record a first metering parameter of a release progress of the virtual memory page to be released corresponding to the first core, wherein when the release progress satisfies a first condition, the first core sends the local variable; Perform atomic operations to update global variables so that the updated global variables match the release progress of the first core; the global variables are data shared by each core in the multi-core system and are used to record the second metering parameters of all virtual memory pages that need to be released in the multi-core system.

2. The method according to claim 1, further comprising: When the first core traverses a virtual memory area, local variables corresponding to the first core are updated based on the traversal result; wherein the virtual memory area includes at least one virtual memory page; and the traversal result represents the result of the first core traversing a first number of virtual memory areas.

3. The method according to claim 2, wherein the first core corresponds to at least one virtual memory area, wherein when the first core traverses the virtual memory area, updating the local variables corresponding to the first core based on the traversal result comprises: In a process in which the first core traverses the virtual memory pages in the first virtual memory area one by one, based on a first quantity value of the virtual memory pages to be released in the first virtual memory area, a local variable corresponding to the first core is updated, wherein a first metering parameter of the updated local variable record corresponding to the traversal of the first virtual memory area is the first quantity value; In the process that the first core continues to traverse the virtual memory pages in the second virtual memory area one by one, based on the second quantity value of the virtual memory pages to be released in the second virtual memory area, the corresponding local variable of the first core is updated; wherein the first metering parameter of the updated local variable record corresponding to the traversal of the second virtual memory area is the sum of the first quantity value and the second quantity value; the second virtual memory area and the first virtual memory area have a target traversal order; Until the first core completes traversal of the virtual memory pages of each of the virtual memory areas corresponding to it, the local variables corresponding to the first core are updated, wherein the first metering parameter recorded in the updated local variables corresponding to the completion of traversal of each of the virtual memory areas is the sum of the numbers of virtual memory pages to be released corresponding to each virtual memory area. 4 . The method according to claim 2 , wherein the local variable corresponding to the first core is set in a private storage area corresponding to the first core, and an initial value of the local variable is 0.

5. The method according to claim 1, wherein when the release progress satisfies a first condition, the first core sends the local variable, comprising: When the number of released virtual memory pages corresponding to the release progress meets a second number, the first core sends the local variable.

6. The method according to claim 1, wherein the performing of atomic operations and updating of global variables comprises: An atomic operation is performed to update the second metering parameter recorded in the global variable to a third metering parameter, where the third metering parameter is a difference between the second metering parameter and the first metering parameter.

7. The method according to claim 1, wherein the performing of atomic operations and updating of global variables comprises: After the first core completes updating of its corresponding local variables, performing atomic operations to update global variables; Alternatively, after the target number of cores in the multi-core system complete the update processing of their corresponding local variables, an atomic operation is performed to update the local variables.

8. A memory data processing device for a multi-core system, comprising: an acquisition unit, configured to obtain a local variable sent by the first core during the process of releasing a virtual memory page; wherein the local variable is private data of the first core corresponding to the multi-core system, and is configured to record a first metering parameter of a release progress of the virtual memory page to be released corresponding to the first core, wherein when the release progress satisfies a first condition, the first core sends the local variable; An execution unit is used to perform atomic operations and update global variables so that the updated global variables match the release progress of the first core; the global variables are data shared by each core in the multi-core system and are used to record the second metering parameters of all virtual memory pages that need to be released in the multi-core system.

9. A multi-core system, the multi-core system comprising at least a first core; The first core includes: A memory, used to store applications and data generated by the operation of the applications; A processor, configured to execute the application program to implement: In the process of releasing the virtual memory page, a local variable sent by the first core is obtained; wherein the local variable is private data of the first core corresponding to the multi-core system, and is used to record a first metering parameter of a release progress of the virtual memory page to be released corresponding to the first core, wherein when the release progress satisfies a first condition, the first core sends the local variable; Perform atomic operations to update global variables so that the updated global variables match the release progress of the first core; the global variables are data shared by each core in the multi-core system and are used to record the second metering parameters of all virtual memory pages that need to be released in the multi-core system. 10 . The multi-core system according to claim 9 , wherein the first core further comprises a private storage module, wherein the local variables are configured in the private storage module.