A reserved memory processing method, device, electronic device and medium

By using out-of-order arrays to record the heat status of reserved memory in virtualized scenarios, the problem that the host cannot effectively monitor the hot and cold conditions of reserved memory is solved, and efficient memory management and data overhead are achieved.

CN114595066BActive Publication Date: 2025-08-19ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210265475.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-17
Publication Date
2025-08-19
Estimated Expiration
2042-03-17

AI Technical Summary

Technical Problem

In virtualized scenarios, in the host memory allocation architecture, the hot and cold conditions of reserved memory cannot be monitored by the traditional host operating system, resulting in too much metadata overhead and the hot and cold conditions of reserved memory cannot be effectively recorded.

Method used

The method of out-of-order array is adopted. By obtaining the preset array set, the current heat status and feature information of the target memory segment in the reserved memory are determined, and the feature information is added to the out-of-order array corresponding to the current heat status. Continuous memory slices in the same heat status are recorded in segmented forms, reducing the data overhead of monitoring the heat status of the memory slice.

Benefits of technology

It improves the processing efficiency of reserved memory, reduces data overhead, can effectively monitor the hot and cold conditions of reserved memory in the host, and improves the efficiency of handling memory segments in the same heat state.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114595066B_ABST
    Figure CN114595066B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a method for processing reserved memory, a reserved memory processing device, an electronic device, and a medium, the method comprising obtaining a preset array set; the array set comprising a plurality of disordered arrays corresponding to the preset heat state of the reserved memory; determining the current heat state and characteristic information of the target memory segment in the reserved memory; the characteristic information comprising the slice sequence number and size information corresponding to the continuous memory slices in the target memory segment that are in the same heat state; and adding the characteristic information to the disordered array corresponding to the current heat state. The embodiments of the present application can record continuous memory slices in the same heat state in a segmented form, avoiding recording the heat state for each memory slice one by one, and reducing the data overhead of monitoring the heat state of the memory slice.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of reserved memory processing, and in particular to a reserved memory processing method, a reserved memory processing device, an electronic device, and a medium. Background Art

[0002] In virtualized host memory allocation architectures, to reduce metadata overhead, most host memory is reserved for future allocation to virtual machines. This memory is unavailable to the host kernel, and the kernel's existing functionality is unable to monitor the hot and cold conditions of this memory.

[0003] One existing technique uses a 64-byte page structure to link hot and cold memory pages, each 4 kilobyte in size. While this page structure serves many functions, beyond just hot and cold memory tracking, it incurs significant metadata overhead, and the reserved memory is invisible to traditional host operating systems, making it unsuitable for tracking hot and cold memory status. Summary of the Invention

[0004] In view of the above problems, embodiments of the present application are proposed to provide a reserved memory processing method and a corresponding reserved memory processing device, electronic device and medium that overcome the above problems or at least partially solve the above problems.

[0005] In order to solve the above problem, an embodiment of the present application discloses a method for processing reserved memory, the method comprising:

[0006] Obtaining a preset array set; the array set includes a plurality of random arrays corresponding to a preset heat state of the reserved memory;

[0007] Determining a current heat state and characteristic information of a target memory segment in the reserved memory; the characteristic information including slice sequence numbers and size information corresponding to consecutive memory slices in the target memory segment that are in the same heat state;

[0008] The characteristic information is added to a random array corresponding to the current heat state.

[0009] Optionally, the characteristic information further includes process information corresponding to the continuous memory slice; the random array is composed of item information; and adding the characteristic information to the random array corresponding to the current heat state includes:

[0010] Determine a target random array from the multiple random arrays according to the current heat state;

[0011] Determining sequence information based on the order in which the feature information is added to the random array;

[0012] generating target item information corresponding to the continuous memory slice according to the feature information and the sequence information;

[0013] The target item information is stored in the target random order array.

[0014] Optionally, the method further includes:

[0015] In response to the acquired out-of-order array operation instruction, determining a to-be-processed object corresponding to the out-of-order array processing instruction;

[0016] Perform corresponding processing on the object to be processed according to the disordered array operation instruction;

[0017] The out-of-order array operation instructions include query instructions, add instructions, delete instructions, and scan instructions.

[0018] Optionally, when the data operation instruction is a query instruction, the object to be processed includes a slice sequence number to be queried and process information to be queried; and the corresponding processing of the object to be processed according to the out-of-order array operation instruction includes:

[0019] Determine the random array to be traversed;

[0020] Traverse the random array to be traversed in a preset order;

[0021] For a random array to be traversed, traverse the item information contained therein according to the sequence information contained in the random array to be traversed;

[0022] When the first target item information that matches the slice sequence number to be checked and the process information to be checked is detected, the first target item information is output.

[0023] Optionally, the reserved memory corresponds to a plurality of non-uniform memory access NUMA nodes, and one of the NUMA nodes corresponds to one of the preset array sets; and determining the out-of-order array to be traversed includes:

[0024] Determine the target NUMA node corresponding to the target slice sequence number;

[0025] An array set corresponding to the target NUMA node is determined as a random array to be traversed.

[0026] Optionally, when the data operation instruction is an increment instruction, the object to be processed includes a sequence number of a slice to be incremented, size information to be incremented, and process information to be incremented; and the corresponding processing of the object to be processed according to the random array operation instruction includes:

[0027] Determine a random array to be incremented corresponding to the data operation instruction;

[0028] Extracting free item information according to the sequence information recorded in the random array to be added;

[0029] Using the idle item information to record the sequence number of the slice to be added, the size information to be increased, and the process information to be added;

[0030] determining whether the increment instruction includes first position information;

[0031] If yes, then updating the sequence information of the to-be-incremented random array according to the first position information;

[0032] If not, the sequence information of the to-be-added random order array is updated according to the historical insertion position recorded in the to-be-added random order array.

[0033] Optionally, performing corresponding processing on the object to be processed according to the out-of-order array operation instruction further includes:

[0034] If the size information to be increased is a preset value, traverse the item information in the random array to be increased;

[0035] Determine whether there is a second target item information in the to-be-added random order array that is adjacent to the to-be-added slice sequence number and the same as the to-be-added process information;

[0036] If yes, then update the second target item information according to the sequence number of the slice to be added and the size information to be increased;

[0037] If not, extracting the free item information according to the sequence information recorded in the to-be-incremented array is performed.

[0038] Optionally, when the data operation instruction is a delete instruction, the object to be processed includes information of items to be deleted; and the performing corresponding processing on the object to be processed according to the random array operation instruction includes:

[0039] Determine a random array to be deleted corresponding to the information of the item to be deleted;

[0040] If the item to be deleted corresponds to the last position of the sequence information of the random array to be deleted, then updating the sequence information according to the item information before the item to be deleted;

[0041] If the item to be deleted does not correspond to the first or last position of the sequence information of the random array to be deleted, the previous item information of the item to be deleted is used as the adjacent item information of the next item information of the item to be deleted to update the sequence information;

[0042] Delete the item information to be deleted.

[0043] Optionally, the random array records aging information, and the aging information is used to point to the item information corresponding to the first position in the sequence information; and the corresponding processing of the object to be processed according to the random array operation instruction further includes:

[0044] If the item information to be deleted corresponds to the first item of the sequence information of the random array record to be deleted, the aging information is updated according to the next item information of the item information to be deleted in the sequence information.

[0045] Optionally, when the data operation instruction is a delete instruction, the object to be processed includes second position information, a sequence number of a slice to be deleted, and size information of a slice to be deleted; and the corresponding processing of the object to be processed according to the out-of-order array operation instruction includes:

[0046] Determining third target item information corresponding to the second location information;

[0047] When the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information, and the size information to be deleted is smaller than the size information of the third target item information, updating the size information of the third target item information according to the size information to be deleted, and updating the sequence number of the slice of the third target item information;

[0048] When the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information, and the size information to be deleted is not less than the size information of the third target item information, deleting the third target item information;

[0049] When the sequence number of the slice to be deleted is inconsistent with the sequence number of the slice of the third target item information, and the sum of the sequence number of the slice to be deleted and the size information to be deleted is not less than the sum of the sequence number of the slice and the size information of the third target item information, updating the size information of the third target item information according to the size information to be deleted;

[0050] When the slice sequence number to be deleted is inconsistent with the slice sequence number of the third target item information, and the sum of the slice sequence number to be deleted and the size information to be deleted is less than the sum of the slice sequence number and the size information of the third target item information, determine that the target memory segment corresponding to the third target item information is divided into a first memory segment and a second memory segment that do not correspond to the object to be processed, update the size information of the third target item information according to the described method, and generate an increase instruction for the second memory segment.

[0051] Optionally, when the data operation instruction is a scan instruction, the object to be processed includes a random array to be scanned; and the performing corresponding processing on the object to be processed according to the random array operation instruction includes:

[0052] Determining a first heat state corresponding to the out-of-order array to be scanned;

[0053] Scanning the memory segment to be scanned corresponding to the item information in the random array to be scanned;

[0054] When the slice corresponding to the memory segment to be scanned changes to a second heat state, determining a sequence number of a slice to be moved, size information to be moved, and process information to be moved corresponding to the slice corresponding to the second heat state;

[0055] Updating the item information corresponding to the sequence number of the slice to be moved, the size information to be moved, and the process information to be moved in the random array to be scanned;

[0056] The sequence number of the slice to be moved, the size information to be moved, and the process information to be moved are added to the random array corresponding to the second heat state.

[0057] The embodiment of the present application further discloses a reserved memory processing device, the device comprising:

[0058] An acquisition module, configured to acquire a preset array set; the array set includes a plurality of random arrays corresponding to a preset heat state of the reserved memory;

[0059] a determination module, configured to determine a current heat state and characteristic information of a target memory segment in the reserved memory; the characteristic information including slice sequence numbers and size information corresponding to consecutive memory slices in the target memory segment that are in the same heat state;

[0060] An adding module is used to add the characteristic information to a random array corresponding to the current popularity state.

[0061] An embodiment of the present application also discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the processing method for reserving memory as described above.

[0062] An embodiment of the present application further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the processing method for reserving memory as described above are implemented.

[0063] The embodiments of the present application include the following advantages:

[0064] By obtaining an array set containing multiple disordered arrays that is pre-constructed corresponding to the preset heat state of the reserved memory, the current heat state and characteristic information of the target memory segment in the reserved memory are determined, and the characteristic information is added to the disordered array corresponding to the current heat state, thereby recording continuous memory slices in the same heat state in a segmented form, avoiding recording the heat state for each memory slice, reducing the data overhead of monitoring the heat state of the memory slice, and according to the ability to collect the characteristic information of memory segments with the same current heat state into a disordered array, the processing efficiency of the memory segments with the same heat state is improved. At the same time, the order of the segmented memory in the array set is determined according to the aging time order of the heat change, and the slice sequence number and size information contained in the characteristic information immediately identify the heat state of a memory segment, so that the hot and cold conditions of the reserved memory of the host machine can be monitored with less data overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 This is a flowchart of an embodiment of a method for processing reserved memory of the present application;

[0066] Figure 2 This is a schematic diagram of a reserved memory management framework of this application;

[0067] Figure 3 This is a flowchart of another embodiment of a method for processing reserved memory of the present application;

[0068] Figure 4 This is a structural block diagram of an embodiment of a processing device with reserved memory in the present application. DETAILED DESCRIPTION

[0069] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0070] Reference Figure 1 , shows a flowchart of an embodiment of a method for processing reserved memory of the present application, which may specifically include the following steps:

[0071] Step 101: Obtain a preset array set; the array set includes a plurality of random arrays corresponding to a preset heat state of the reserved memory;

[0072] In a virtualization scenario, the reserved memory may include multiple memory addresses. Different memory addresses correspond to different heat states. Embodiments of the present application may construct different random arrays for different heat states. For example, heat states may include a cold state (also called an inactive state) and a hot state (also called an active state). A hot state array may be constructed for the hot state, and a cold state array may be constructed for the cold state. The hot state array and the cold state array may be used as an array set.

[0073] In an example, the heat state may further include a paused state and a pinned state, and the out-of-order array set may further include: a paused state array constructed for the paused state, and a pinned state array constructed for the pinned state.

[0074] Step 102: determining the current heat state and characteristic information of the target memory segment in the reserved memory; the characteristic information includes the slice sequence number and size information corresponding to the continuous memory slices in the target memory segment with the same heat state;

[0075] A memory segment can include one or more memory slices. The slice sequence number can be used to identify different memory slices. Furthermore, the slice sequence number can be the physical address of the memory slice, and the size information can be the number of slices. Based on the slice sequence number and size information, the number of memory slices contained in the target memory segment and their specific physical addresses can be determined. The capacity of the memory segment can also be determined based on the memory slice capacity and size information. For example, if the capacity of a single memory slice is 2MB (megabytes) and the memory segment size information is 3, then the capacity of the memory segment is 6MB.

[0076] As can be seen from the above, a continuous memory slice can be identified by the slice number and size information, and since the heat state of the reserved memory may be localized, that is, at a certain moment, a certain continuous memory slice is all hot or all cold. The heat state of multiple memory slices can be recorded in a segmented form, that is, the memory slices are divided according to the heat state, and continuous memory slices with the same heat state are divided, and then the characteristic information corresponding to the continuous memory slices with the same heat state is determined. By recording the heat state of multiple memory slices in a segmented form, the data overhead of monitoring the heat state of the reserved memory is reduced.

[0077] The target memory segment can be a newly reserved memory or a specified memory segment.

[0078] The current heat status of the memory segment and the characteristic information corresponding to the memory segment can be determined through real-time monitoring. The characteristic information can be used to include but is not limited to the metadata of the memory segment to distinguish and describe the corresponding memory segment.

[0079] In one example, the current heat state of a memory segment can be determined as follows: First, the virtual address of the process corresponding to the memory slice is obtained. If the virtualization scenario is virtualized, the virtual address is used to determine whether the access bit of the virtualized page table is set. If the access bit of the virtualized page table is set, the current heat state corresponding to the memory slice is hot. If the access bit of the virtualized page table is not set, the kernel page table of the process is read. If the kernel page table access bit is set, the current heat state corresponding to the memory slice is hot; otherwise, the current heat state is cold.

[0080] Step 103: Add the characteristic information to a random array corresponding to the current popularity state.

[0081] After determining the characteristic information and current heat state of the memory segment, the characteristic information can be stored in a random array corresponding to the current heat state, so that the characteristic information corresponding to the memory segment with the same heat state is recorded in the same random array.

[0082] Since the feature information corresponds to continuous memory slices in the same heat state, one feature information corresponds to a section of continuous memory slices in the same heat state. By adding the feature information to the shuffled array, the shuffled array can record the corresponding feature information for the continuous memory slices in the same heat state, thereby recording the continuous memory slices in the same heat state in a segmented form, avoiding recording the heat state of each memory slice one by one.

[0083] In an embodiment of the present application, an array set containing multiple disordered arrays constructed in advance corresponding to a preset heat state of the reserved memory is obtained, the current heat state and characteristic information of the target memory segment in the reserved memory are determined, and the characteristic information is added to the disordered array corresponding to the current heat state, so that continuous memory slices in the same heat state are recorded in a segmented form, avoiding recording the heat state for each memory slice, reducing the data overhead of monitoring the heat state of the memory slice, and according to the ability to collect the characteristic information of memory segments with the same current heat state into a disordered array, the processing efficiency of memory segments with the same heat state is improved, and at the same time, the order of the segmented memory in the array set is determined according to the aging time order of the heat change, and the slice sequence number and size information contained in the characteristic information immediately identify the heat state of a memory segment, so that the hot and cold conditions of the reserved memory of the host machine can be monitored with less data overhead.

[0084] Reference Figure 2, shows a schematic diagram of a reserved memory management framework of the present application, including: multiple non-uniform memory access NUMA (Non Uniform Memory Access) nodes (such as Figure 2 The array set constructed by Node1 and Node2 in the figure is shown. One NUMA node corresponds to one preset array set. The array set includes disordered arrays corresponding to different heat states (for example: Figure 2 In the inactive1, inactive2, active1, active 2), the disordered array is composed of item information, the item information is used to record the characteristic information of the memory segment, the data can identify the heat status of the memory segment corresponding to the characteristic information contained therein, and these item information can be precipitated and organized according to their time information (for example: calling the LRU algorithm, i.e. the least recently used algorithm), so as to directly process the characteristic information of the reserved memory, and then process it into the heat status of the reserved memory. The reserved memory management method provided in the embodiment of the present application can be implemented based on the above-mentioned reserved memory management framework. With reference to Figure 3 , shows a flowchart of another embodiment of a method for processing reserved memory of the present application, which may specifically include the following steps:

[0085] Step 301: Obtain a preset array set; the array set includes a plurality of random arrays corresponding to a preset heat state of the reserved memory;

[0086] The array set may be obtained by reading the out-of-order arrays of each NUMA node in the reserved memory management framework.

[0087] Step 302: Determine the current heat state and characteristic information of the target memory segment in the reserved memory; the characteristic information includes the slice sequence number and size information corresponding to the continuous memory slices in the target memory segment with the same heat state, and the process information corresponding to the continuous memory slices;

[0088] Step 303: Add the characteristic information to the random array corresponding to the current popularity state;

[0089] In an optional embodiment of the present application, step 303 includes: determining a target random array among the multiple random arrays according to the current heat state; determining sequence information based on the order in which the feature information is added to the random array; generating target item information corresponding to the continuous memory slice based on the feature information and the sequence information; and storing the feature information and the target item information in the target random array.

[0090] like Figure 2As shown, the item information in the random array includes an idx field, a size field, a pid field, and a next field, wherein the idx field is used to record the slice number, the size field is used to record the size information, the pid field is used to record the process information, and the next field is used to record the next item information containing the next field item information under the same random array, that is, the next field is used to point to the next item information, and then the sequence information of the item information in the random array can be determined through the next field of each item information in the random array, and the sequence information corresponds to the chronological order of the item information stored in the random array.

[0091] In addition, the random array can also record the number of item information, aging information (for example, the old field can be set to point to the oldest item information, that is, the earliest record of the item information contained in the random array), usage rate, etc. The relevant information recorded in the random array can be expanded according to actual needs, wherein the aging information is used to point to the item information corresponding to the first position in the sequence information.

[0092] Step 304: In response to the acquired out-of-order array operation instruction, determine the to-be-processed object corresponding to the out-of-order array processing instruction;

[0093] The data operation instruction may be received through an external device (eg, a server, an input component, etc.), or may be generated by the above-mentioned reserved memory management framework.

[0094] The object to be processed may include the slice sequence number, size information, and process information mentioned above.

[0095] Step 305 , performing corresponding processing on the object to be processed according to the random array operation instruction; wherein the random array operation instruction includes a check instruction, an add instruction, a delete instruction, and a scan instruction.

[0096] By responding to query instructions, add instructions, delete instructions, scan instructions, etc., the host kernel processes the slice sequence number, size information, and process information in the data group, thereby dynamically managing the heat status of the reserved memory.

[0097] In an optional embodiment of the present application, when the data operation instruction is a query instruction, the object to be processed includes the slice serial number to be queried and the process information to be queried; the step 305 includes: determining the random array to be traversed; traversing the random array to be traversed according to a preset order; for one random array to be traversed, traversing the item information contained therein according to the sequence information contained in the random array to be traversed; when detecting the first target item information that matches the slice serial number to be queried and the process information to be queried, outputting the first target item information.

[0098] When the data operation instruction is a query instruction, the array identifier for identifying the shuffled array contained in the data operation instruction can be extracted to determine the shuffled array to be traversed. The shuffled arrays corresponding to the array identifiers are then traversed in a predetermined order. For each shuffled array to be traversed, the item information contained in the shuffled array to be traversed is traversed to determine and output the first target item information that matches the slice sequence number to be traversed and the process information to be traversed.

[0099] In an optional embodiment of the present application, determining the out-of-order array to be traversed includes: determining a target NUMA node corresponding to the target slice sequence number; and determining an array set corresponding to the target NUMA node as the out-of-order array to be traversed.

[0100] Array sets are correspondingly set for the multiple NUMA (Non Uniform Memory Access) nodes divided into the reserved memory as described above, and one NUMA node corresponds to one array set. The physical address range of the reserved memory corresponding to the NUMA node is pre-set. By determining the physical address corresponding to the target slice serial number and combining the physical address ranges of each NUMA node, the NUMA node containing the physical address corresponding to the target slice serial number can be determined as the target NUMA node, and then the out-of-order array contained in the array set corresponding to the target NUMA node can be determined as the out-of-order array to be traversed. By determining the out-of-order array to be traversed based on the target memory slice serial number, the out-of-order array to be traversed can be screened, thereby improving the response efficiency of the query instruction.

[0101] The following example further illustrates the processing of a disordered array when the data operation instruction is a query instruction:

[0102] The object to be processed is the search keyword, including the slice number to be searched and the process information to be searched;

[0103] a1) Obtain the out-of-order array protection lock of the NUMA node where the slice number to be checked is located, and adjust the protection lock to the unlocked state;

[0104] b1) From all the out-of-order arrays of this NUMA node, traverse each out-of-order array in this order;

[0105] c1) For each random array, starting from the item pointed to by the old field (recording the oldest aging information) of the random array, all item information are sequentially facilitated;

[0106] d1) Determine whether the slice number to be checked is within the range represented by an item of information, and whether the process information recorded in the item of information is equal to the process information to be checked; if found, jump to step g1); otherwise, execute step e1);

[0107] e1) Determine whether the next item in the item information is a new item (the next item in the last item information points to itself); if yes, jump to step d1); otherwise, execute step f1);

[0108] f1) Determine whether all out-of-order arrays of this NUMA node have been traversed; if not, jump to step b;

[0109] g1) Returns the found item information (first target item information) and the location of the item information that matches the slice sequence number and process information to be queried.

[0110] In an optional embodiment of the present application, when the data operation instruction is an increase instruction, the object to be processed includes the serial number of the slice to be increased, the size information to be increased, and the process information to be increased; the step 305 includes: determining the random array to be increased corresponding to the data operation instruction; extracting the free item information according to the sequence information recorded in the random array to be increased; using the free item information to record the serial number of the slice to be increased, the size information to be increased, and the process information to be increased; judging whether the increase instruction contains the first position information; if it contains the first position information, updating the sequence information of the random array to be increased according to the first position information; if it does not contain the first position information, updating the sequence information of the random array to be increased according to the historical insertion position recorded in the random array to be increased.

[0111] The data operation instruction may record an array identifier corresponding to the random array to be added, determine the random array to be added according to the array identifier, and extract free item information, which is item information whose characteristic information is empty. If the increment instruction contains specified first position information, the sequence information of the random array to be added is updated according to the first position information, so that the item information recording the sequence number of the slice to be added, the size information to be increased, and the process information to be added corresponds to the first position information. If the increment instruction does not contain the specified first position information, the sequence information is updated according to the position where the characteristic information was last inserted.

[0112] For the size information to be increased of a specific size, try to merge this new area first. At this time, before extracting the free item information according to the sequential information recorded in the random array to be increased, step 305 also includes: if the size information to be increased is a preset value, traverse the item information in the random array to be increased; determine whether there is a second target item information in the random array to be increased that is adjacent to the slice number to be increased and the same as the process information to be increased; if so, update the second target item information according to the slice number to be increased and the size information to be increased; if not, execute the extraction of free item information according to the sequential information recorded in the random array to be increased.

[0113] In an actual example, the preset value is 1, that is, the size information to be increased is a memory slice of 1 unit size. It is understandable that the preset value can be customized to 1 or other values, and the size of the preset value does not affect the implementation of the embodiment of the present application. When the size information is the preset value, the second target item information that is adjacent to the serial number of the slice to be increased and is the same as the entry information to be increased is determined. The second target item information is updated according to the size information to be increased and the serial number of the slice to be increased, so as to merge the feature information that needs to be recorded into the second target item information, and record the feature information related to the serial number of the slice to be increased without increasing the number of item information in the array to be increased, so as to avoid generating too much fragmented item information, which causes the disordered array to be quickly filled up.

[0114] The following example shows that when the data operation instruction is an increment instruction, the processing process for the specified out-of-order array can be as follows:

[0115] a2) determining the size of the small information to be increased, if the value of the small information to be increased is 1, executing step b2); if the value of the small information to be increased is not 1, executing step e2);

[0116] b2) traverse each item information of the random array where the specified random array is located;

[0117] c2) Determine whether the sequence number of the slice to be added is adjacent to the head or tail of the information to be changed; if so, directly update the sequence number of the slice to be added or the size information to be increased of the information to complete the response to the increase instruction; otherwise, execute step d);

[0118] d2) Determine whether the traversal is completed. If not, proceed to step b2); otherwise, proceed to step e2);

[0119] e2) Determine whether the specified random array is full; if so, double the capacity of the random array and copy the original data (the item information before the random array expansion). At the same time, update the specified random array and its total number and other related fields.

[0120] f2) Get an idle item from the beginning of the specified random array;

[0121] g2) Generate new item information by adding [slice number to be added, size information to be added, and process information to be added];

[0122] h2) Determine whether a specified insertion position (such as the first position information mentioned above) exists. If so, determine the specified position as the position to be inserted; if not, use the position executed by the cur field of the random array (the position of the last inserted item information) as the position to be inserted;

[0123] i2) Determine whether the position to be inserted is the head of the specified random array; if so, point the oldest field old in the specified random array to the current item information;

[0124] j2) Otherwise, the next field of the item information where the insertion position is located is pointed to the current item information;

[0125] k2) Determine whether the position to be inserted is the tail of the specified random array; if not, record the next field of the current item information as the next item information pointing to the original item information to be inserted;

[0126] 12) Otherwise, the next field of the item information points to the current item information itself;

[0127] m2) Updates the number of used item information in the specified random array.

[0128] In an optional embodiment of the present application, when the data operation instruction is a delete instruction, the object to be processed includes information about items to be deleted; the step 305 includes: determining the random array to be deleted corresponding to the information about items to be deleted; if the information about items to be deleted corresponds to the last bit of the sequence information recorded in the random array to be deleted, updating the sequence information according to the item information before the information about items to be deleted; if the information about items to be deleted does not correspond to the first or last bit of the sequence information recorded in the random array to be deleted, using the previous item information of the information about items to be deleted as the adjacent item information of the next item information of the information about items to be deleted to update the sequence information; and deleting the information about items to be deleted.

[0129] The above-mentioned updating sequence information is to update the next field of each item in the to-be-deleted random array, thereby updating the sequence information corresponding to each item in the to-be-deleted array. If the to-be-deleted item is the last item in the to-be-deleted random array, the next field of the item before the to-be-deleted item is updated.

[0130] If the item to be deleted is neither the last nor the first item in the random array to be deleted, the previous item of the item to be deleted is used as the adjacent item of the next item to be deleted, so that the next item of the previous item of the item to be deleted is the next item of the item to be deleted, so as to update the sequence information.

[0131] After the sequence information is updated, the feature information included in the item information to be deleted is deleted.

[0132] In an optional embodiment of the present application, the corresponding processing of the object to be processed according to the random array operation instruction also includes: if the to-be-deleted item information corresponds to the first position of the sequence information of the to-be-deleted random array record, then the aging information is updated according to the next item information of the to-be-deleted item information in the sequence information.

[0133] If the item to be deleted corresponds to the first position in the sequence information, the aging information needs to be updated so that the aging information points to the item information corresponding to the first position in the sequence information after the item to be deleted is deleted. This item information is the next item information after the item to be deleted before the item to be deleted is deleted.

[0134] The following example further illustrates the processing of a random array when the data operation instruction is a scan instruction:

[0135] a3) Determine whether the item to be deleted is the item pointed to by the old field of the random array; if so, execute step b3); otherwise, execute step c3);

[0136] b3) The old field needs to be updated to point to the item information where the next field of the item to be deleted is located;

[0137] c3) Determine whether the item to be deleted is the last item in the random array; if so, execute step d3); otherwise, execute step e3);

[0138] d3) Update the cur field to point to the location of the previous item to be deleted;

[0139] e3) updating the next field of the previous item information of the to-be-deleted item information to the next field of the to-be-deleted item information;

[0140] f3) Clear the content of the information to be deleted;

[0141] g3) Update the number of used item information in the random array.

[0142] In an optional embodiment of the present application, when the data operation instruction is a delete instruction, the object to be processed includes the second position information, the sequence number of the slice to be deleted, and the size information to be deleted, indicating that characteristic information of the memory segment recorded in the specified position (second position information) (determined according to the sequence number of the slice to be deleted and the size information to be deleted) needs to be deleted. Step 305 includes:

[0143] Determining third target item information corresponding to the second location information;

[0144] When the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information, and the size information to be deleted is smaller than the size information of the third target item information, updating the size information of the third target item information according to the size information to be deleted, and updating the sequence number of the slice of the third target item information;

[0145] When the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information, and the size information to be deleted is not less than the size information of the third target item information, deleting the third target item information;

[0146] When the sequence number of the slice to be deleted is inconsistent with the sequence number of the slice of the third target item information, and the sum of the sequence number of the slice to be deleted and the size information to be deleted is not less than the sum of the sequence number of the slice and the size information of the third target item information, updating the size information of the third target item information according to the size information to be deleted;

[0147] When the slice sequence number to be deleted is inconsistent with the slice sequence number of the third target item information, and the sum of the slice sequence number to be deleted and the size information to be deleted is less than the sum of the slice sequence number and the size information of the third target item information, determine that the target memory segment corresponding to the third target item information is divided into a first memory segment and a second memory segment that do not correspond to the object to be processed, update the size information of the third target item information according to the described method, and generate an increase instruction for the second memory segment.

[0148] If the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information, and the size information to be deleted is smaller than the size information of the third target item information, it indicates that the characteristic information of the memory segment to be deleted corresponds to the third target item information, and the size information of the third target item information can be updated according to the size information to be deleted. For example, if the size information to be deleted is 4 and the size information in the target third item information is 6, the size information of the updated third target item information is 2. Since the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information, the sequence number of the slice of the third target item information is updated according to the size information to be deleted and the sequence number of the slice to be deleted. For example, if the sequence number of the slice to be deleted is 003 and the size information to be deleted is 4, the slice sequence number of the updated third target item information is 007.

[0149] If the slice sequence number to be deleted is consistent with the slice sequence number of the third target item information, and the size information to be deleted is not less than the size information of the third target item information, it means that the entire third target item information must be deleted, and a deletion instruction can be generated for the third target item information. Specifically, a deletion instruction is generated based on the slice sequence number and size information in the third target item information, and the deletion instruction is responded to to delete the third target item information.

[0150] If the slice sequence number to be deleted is inconsistent with the slice sequence number of the third target item information, and the sum of the slice sequence number to be deleted and the size information to be deleted is not less than the sum of the slice sequence number and the size information of the third target item information, for example: the slice sequence number of the third target item information is 001, the size information of the third target item information is 4, the slice sequence number to be deleted is 003, and the size information to be deleted is 4, then the sum of the slice sequence number to be deleted and the size information to be deleted is 007, and the sum of the slice sequence number and the size information of the third target item information is 005, then the size information of the third target item information is updated, and the updated size information of the third target item information is 2, so as to delete the characteristic information of the memory segment corresponding to the deletion instruction in the third target item information.

[0151] If the slice sequence number to be deleted is inconsistent with the slice sequence number of the third target item information, and the sum of the slice sequence number to be deleted and the size information to be deleted is less than the sum of the slice sequence number and size information of the third target item information, then the memory segment corresponding to the third target item information needs to be divided into a first memory segment, a second memory segment and a third memory segment determined by the slice sequence number to be deleted and the size information to be deleted. Since the feature information corresponding to the third memory segment needs to be deleted, the update can be completed for the first memory segment by updating the size information of the third target item information, and an increase instruction is generated for the second memory segment to add new item information to the current random array. Specifically, the slice sequence number corresponding to the first slice of the second memory segment can be determined, as well as the size information and process information of the second memory segment, and an increase instruction is generated for the slice sequence number and the size information and process information of the second internal segment. By responding to the increase instruction, the item information matching the second memory segment is added to the current random array. The specific execution process can refer to the above-mentioned processing process of the increase instruction in the book, which will not be repeated here.

[0152] The following further illustrates the process of processing a disordered array when the data operation instruction is a delete instruction using another example: the object to be processed includes the second position information, the sequence number of the slice to be deleted, the size information to be deleted, and the process information to be deleted;

[0153] a4) determining whether the sequence number of the slice to be deleted is consistent with the sequence number of the starting position slice of the third target item information corresponding to the second position information; if consistent, executing step b4); if inconsistent, executing step e;

[0154] b4) determining whether the size information to be deleted is smaller than the range of the third target item information corresponding to the second position information; if so, executing step c4); otherwise, executing step d4);

[0155] c4) shrinking the third target item information and updating the slice sequence number of the third target item information;

[0156] d4) deleting the third target item information;

[0157] e4) Determine whether the sum of the sequence number of the slice to be deleted and the size information to be deleted is not less than the end of the third target item information (i.e., the sum of the sequence number of the slice and the size information of the third target item information); if so, execute step f4); otherwise, execute step g4);

[0158] f4) reducing the size of the third target item information and updating the size information of the third target item information;

[0159] g4) Delete the middle part corresponding to the to-be-deleted slice number and to-be-deleted size information in the third target item information; and shrink the remaining first half, and the remaining second half needs to insert a new item information after the third target item of the random array.

[0160] In an optional embodiment of the present application, a scan instruction can be generated according to a preset cycle to scan the hot and cold states of each memory slice. When the data operation instruction is a scan instruction, the object to be processed includes a random array to be scanned; the random array to be scanned can be an array set corresponding to one or more NUMA nodes, or a specified random array corresponding to a specified NUMA node. For example, the array to be scanned can be an array set corresponding to Node1, or it can be the inactive2 array of Node2. Step 305 includes: determining a first heat state corresponding to the random array to be scanned; scanning the memory segment to be scanned corresponding to the item information in the random array to be scanned; when the slice corresponding to the memory segment to be scanned changes to a second heat state, determining the slice sequence number to be moved, the size information to be moved, and the process information to be moved corresponding to the slice corresponding to the second heat state; updating the item information corresponding to the slice sequence number to be moved, the size information to be moved, and the process information to be moved in the random array to be scanned; and adding the slice sequence number to be moved, the size information to be moved, and the process information to be moved to the random array corresponding to the second heat state.

[0161] The first heat state is the heat state corresponding to when constructing the random array to be scanned. For example, when constructing the random array, a cold state array is constructed for the cold state. If the random array to be scanned is a cold state array, the first heat state is a cold state; if the random array to be scanned is a hot state array, the first heat state is a hot state. When scanning the random array to be scanned, the heat state of the memory slice corresponding to each item information contained therein is determined. When it is confirmed that the heat state of any memory slice has changed to the second heat state (the second heat state is one of the heat states other than the first heat state), the characteristic information corresponding to the memory slice that has changed to the second heat state is determined, including the serial number of the slice to be moved, the size information to be moved, and the process information to be moved. The item information corresponding to the memory slice in the second heat state in the array to be scanned is updated to delete the characteristic information of the memory slice that has changed to the second heat state that is remembered in the random array to be scanned. The sequence number of the slice to be moved, the size information to be moved, and the process information to be moved are added to the random array corresponding to the second heat state. Specifically, an increment instruction can be generated for the sequence number of the slice to be moved, the size information to be moved, and the process information to be moved, and the increment instruction is responded to. The specific response process can be referred to the above description and will not be repeated here. By scanning the random array to be scanned, the heat state of the memory slice corresponding to the random array to be scanned is updated, and when the heat state changes, the item information of the corresponding random array is updated.

[0162] The following uses another example to further illustrate the processing of a disordered array when the data operation instruction is a scan instruction:

[0163] a5) Traverse each item in the middle of the random array to be scanned one by one, record its position cur in the random array, as well as its previous position prev and next position next, where the random array to be scanned is a cold array;

[0164] b5) cyclically scan the physical address corresponding to each memory slice within the length of the information to determine whether it is still in a cold state;

[0165] c5) If a slice is found to have become a non-hot state, for example, a hot state, that is, a state jump occurs; determine whether the jump slice number (the slice number to be moved) is recorded;

[0166] d5) If the jump slice number is not recorded, then record the slice number and initialize the size information corresponding to the slice (size information to be moved) to 1; the slice number to be moved, the size information to be moved, and the process information to be moved

[0167] e5) If the jump slice cycle has been recorded, update the size information to be moved;

[0168] f5) If the heat state of the memory slice remains cold, determine whether a transition slice sequence number was recorded before the current moment in response to the scan instruction. If so, a memory region with a transition state has been found and needs to be moved from one random array to another random array_out.

[0169] g5) extracting the characteristic information of this memory region by referring to steps a4) to g4) above, and deleting it from the currently scanned random array;

[0170] h5) Since the process of deleting the feature information of the above-mentioned memory area may delete old information or insert new information, causing its position in the disordered array to change, it is necessary to update the values of prev, cur, and next;

[0171] i5) inserting the extracted feature information of the memory area into the thermal state random array;

[0172] j5) Determine whether the memory slice in the current item information has been scanned. If not, return to step b5); otherwise, execute step k5);

[0173] k5) Determine whether all item information in the random array has been traversed. If not, return to step a5); otherwise, end the entire scanning process and stop responding to the scanning instruction.

[0174] In an embodiment of the present application, an array set comprising multiple random arrays pre-constructed to correspond to a preset heat state of reserved memory is obtained, the current heat state and characteristic information of a target memory segment in the reserved memory are determined, and the characteristic information is added to the random array corresponding to the current heat state. Thus, continuous memory slices in the same heat state are recorded in a segmented manner, avoiding recording the heat state of each memory slice one by one, reducing the data overhead of monitoring the heat state of the memory slices. Furthermore, the characteristic information of memory segments with the same current heat state can be aggregated into a random array, thereby improving the processing efficiency of memory segments with the same heat state. Simultaneously, the order of the segmented memory in the array set is determined based on the aging time sequence of the heat change, and the slice sequence number and size information included in the characteristic information immediately identify the heat state of a memory segment. This allows monitoring the hot and cold conditions of the host machine's reserved memory with less data overhead. By responding to query instructions, add instructions, delete instructions, scan instructions, etc., the host machine kernel processes the slice sequence number, size information, and process information in the data group, thereby dynamically managing the heat state of the reserved memory.

[0175] It should be noted that for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0176] Reference Figure 4 , shows a structural block diagram of an embodiment of a reserved memory processing device of the present application, which may specifically include the following modules:

[0177] The acquisition module 401 is used to acquire a preset array set; the array set includes multiple arrays corresponding to the preset heat state of the reserved memory;

[0178] Determination module 402, configured to determine the current heat state and characteristic information of the target memory segment in the reserved memory; the characteristic information includes the sequence number and size information of the slices in the same heat state as the target memory segment;

[0179] The adding module 403 is used to add the feature information to the array corresponding to the current popularity state.

[0180] In an optional embodiment of the present application, the feature information further includes process information corresponding to the continuous memory slice; the out-of-order array is composed of item information; and the adding module 403 includes:

[0181] a target random array determination submodule, configured to determine a target random array from among the plurality of random arrays according to the current heat state;

[0182] A sequence information determination submodule, configured to determine sequence information based on the order in which the feature information is added to the random array;

[0183] a target item information generating submodule, configured to generate target item information corresponding to the continuous memory slice based on the feature information and the sequence information;

[0184] The target item information storage submodule is used to store the target item information into the target random array.

[0185] In an optional embodiment of the present application, the device further includes:

[0186] a module for determining an object to be processed, configured to determine an object to be processed corresponding to an acquired out-of-order array operation instruction in response to the acquired out-of-order array operation instruction;

[0187] A module for processing objects to be processed, configured to process the objects to be processed accordingly according to the random array operation instruction;

[0188] The out-of-order array operation instructions include query instructions, add instructions, delete instructions, and scan instructions.

[0189] In an optional embodiment of the present application, when the data operation instruction is a query instruction, the object to be processed includes a slice sequence number to be queried and process information to be queried; and the object to be processed processing module includes:

[0190] A submodule for determining the disordered array to be traversed, used for determining the disordered array to be traversed;

[0191] A submodule for traversing the disordered array to be traversed, used for traversing the disordered array to be traversed in a preset order;

[0192] An item information first traversal submodule, configured to traverse the item information contained in a random array to be traversed according to the sequence information contained in the random array to be traversed;

[0193] The first target item information matching submodule is used to output the first target item information when the first target item information that matches the slice sequence number to be checked and the process information to be checked is detected.

[0194] In an optional embodiment of the present application, the reserved memory corresponds to multiple non-uniform memory access NUMA nodes, and one of the NUMA nodes corresponds to one of the preset array sets; the submodule for determining the out-of-order array to be traversed includes:

[0195] A target NUMA node determining unit, configured to determine a target NUMA node corresponding to the target slice sequence number;

[0196] The out-of-order array to be traversed determining unit is used to determine the array set corresponding to the target NUMA node as the out-of-order array to be traversed.

[0197] In an optional embodiment of the present application, when the data operation instruction is an increment instruction, the object to be processed includes a sequence number of a slice to be incremented, size information to be incremented, and process information to be incremented; and the object processing module to be processed includes:

[0198] A to-be-incremented random-order array determination submodule, configured to determine the to-be-incremented random-order array corresponding to the data operation instruction;

[0199] A free item information extraction submodule, configured to extract free item information according to the sequence information recorded in the random array to be added;

[0200] An idle item information recording submodule, configured to use the idle item information to record the sequence number of the slice to be added, the size information to be increased, and the process information to be added;

[0201] The first position information judgment submodule is used to judge whether the increase instruction contains the first position information; if so, the sequence information of the random array to be increased is updated according to the first position information; if not, the sequence information of the random array to be increased is updated according to the historical insertion position recorded by the random array to be increased.

[0202] In an optional embodiment of the present application, the module for processing objects to be processed further includes:

[0203] The second item information traversal submodule is used for traversing the item information in the random array to be increased if the size information to be increased is a preset value;

[0204] The second target item information judgment submodule is used to judge whether there is a second target item information in the to-be-added random array that is adjacent to the to-be-added slice sequence number and the same as the to-be-added process information; if so, the second target item information is updated according to the to-be-added slice sequence number and the to-be-added size information; if not, the free item information extraction submodule is called.

[0205] In an optional embodiment of the present application, when the data operation instruction is a delete instruction, the object to be processed includes information of an item to be deleted; and the object to be processed processing module includes:

[0206] A to-be-deleted random order array determination submodule is used to determine the to-be-deleted random order array corresponding to the to-be-deleted item information;

[0207] a first sequence information updating submodule, configured to update the sequence information according to the item information preceding the item information to be deleted, if the item information to be deleted corresponds to the last bit of the sequence information recorded in the random array to be deleted;

[0208] a second sequence information updating submodule, configured to update the sequence information by using the previous item of the to-be-deleted information as the adjacent item of the next item of the to-be-deleted information if the to-be-deleted information does not correspond to the first or last position of the sequence information recorded in the to-be-deleted random array;

[0209] The to-be-deleted information deleting submodule is used to delete the to-be-deleted information.

[0210] In an optional embodiment of the present application, the random array records aging information, and the aging information is used to point to the item information corresponding to the first position in the sequence information; the object processing module to be processed further includes:

[0211] The third sequence information updating submodule is configured to update the aging information according to the next item of the to-be-deleted information in the sequence information if the to-be-deleted item corresponds to the first item of the sequence information recorded in the to-be-deleted random array.

[0212] In an optional embodiment of the present application, when the data operation instruction is a delete instruction, the object to be processed includes the second position information, the sequence number of the slice to be deleted, and the size information of the slice to be deleted; and the object processing module includes:

[0213] A third target item information determination submodule, configured to determine third target item information corresponding to the second location information;

[0214] a first processing submodule for the third target item information, configured to update the size information of the third target item information according to the size information to be deleted, and update the slice sequence number of the third target item information, when the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information and the size information to be deleted is smaller than the size information of the third target item information;

[0215] A second processing submodule for the third target item information is configured to delete the third target item information when the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information and the size information to be deleted is not less than the size information of the third target item information;

[0216] a third processing submodule for the third target item information, configured to update the size information of the third target item information according to the size information to be deleted, when the sequence number of the slice to be deleted is inconsistent with the sequence number of the slice to be deleted and the size information to be deleted is not less than the sum of the sequence number of the slice to be deleted and the size information of the third target item information;

[0217] The fourth processing sub-module of the third target item information is used to determine that the target memory segment corresponding to the third target item information is divided into a first memory segment and a second memory segment that do not correspond to the object to be processed when the slice sequence number to be deleted is inconsistent with the slice sequence number of the third target item information, and the sum of the slice sequence number to be deleted and the size information to be deleted is less than the sum of the slice sequence number and the size information of the third target item information, update the size information of the third target item information according to the above, and generate an increase instruction for the second memory segment.

[0218] In an optional embodiment of the present application, when the data operation instruction is a scan instruction, the object to be processed includes a random array to be scanned; and the object processing module to be processed includes:

[0219] A first heat state determination submodule, configured to determine a first heat state corresponding to the out-of-order array to be scanned;

[0220] A submodule for determining a memory segment to be scanned, configured to scan the memory segment to be scanned corresponding to the item information in the random array to be scanned;

[0221] A second heat state determination submodule is configured to determine, when a slice corresponding to the memory segment to be scanned changes to a second heat state, a sequence number of a slice to be moved, size information to be moved, and process information to be moved corresponding to the slice corresponding to the second heat state;

[0222] A submodule for updating the random array to be scanned, configured to update, in the random array to be scanned, item information corresponding to the sequence number of the slice to be moved, the size information to be moved, and the process information to be moved;

[0223] The submodule for adding objects to be processed is used to add the serial number of the slice to be moved, the size information to be moved, and the process information to be moved to the disordered array corresponding to the second heat state.

[0224] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0225] An embodiment of the present application further provides an electronic device, including:

[0226] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned reserved memory processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0227] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned reserved memory processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0228] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0229] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0230] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0231] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0232] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0233] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0234] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.

[0235] The above is a detailed introduction to a reserved memory processing method and a reserved memory processing device, electronic device and medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for processing reserved memory, characterized in that: The method comprises: Obtaining a preset array set; the array set includes a plurality of random arrays corresponding to a preset heat state of the reserved memory; Determining a current heat state and characteristic information of a target memory segment in the reserved memory; the characteristic information including slice sequence numbers and size information corresponding to consecutive memory slices in the target memory segment that are in the same heat state; Adding the characteristic information to a random array corresponding to the current popularity state; Among them, the virtual address of the process corresponding to the memory slice is obtained; If it is a virtualization scenario, determine whether the access bit of its virtualization page table is set based on the virtual address; If the access bit of the virtualized page table is set, the current temperature state corresponding to the memory slice is hot; If the access bit of the virtualized page table is not set, reading the kernel page table of the process; If the access bit of the kernel page table is set, the current heat state corresponding to the memory slice is hot; If the access bit of the kernel page table is not set, the current heat state corresponding to the memory slice is a cold state.

2. The method according to claim 1, characterized in that The characteristic information further includes process information corresponding to the continuous memory slice; the random array is composed of item information; and adding the characteristic information to the random array corresponding to the current heat state includes: Determine a target random array from the multiple random arrays according to the current heat state; Determining sequence information based on the order in which the feature information is added to the random array; generating target item information corresponding to the continuous memory slice according to the feature information and the sequence information; The target item information is stored in the target random order array.

3. The method according to claim 2, characterized in that The method further comprises: In response to the acquired out-of-order array operation instruction, determining a to-be-processed object corresponding to the out-of-order array operation instruction; Perform corresponding processing on the object to be processed according to the disordered array operation instruction; The out-of-order array operation instructions include query instructions, add instructions, delete instructions, and scan instructions.

4. The method according to claim 3, characterized in that When the random array operation instruction is a query instruction, the object to be processed includes a slice sequence number to be queried and process information to be queried; and the corresponding processing of the object to be processed according to the random array operation instruction includes: Determine the random array to be traversed; Traverse the random array to be traversed in a preset order; For a random array to be traversed, traverse the item information contained therein according to the sequence information contained in the random array to be traversed; When the first target item information that matches the slice sequence number to be checked and the process information to be checked is detected, the first target item information is output.

5. The method according to claim 4, characterized in that The reserved memory corresponds to a plurality of non-uniform memory access NUMA nodes, and one of the NUMA nodes corresponds to one of the preset array sets; Determining the out-of-order array to be traversed includes: Determine the target NUMA node corresponding to the slice sequence number to be checked; An array set corresponding to the target NUMA node is determined as a random array to be traversed.

6. The method according to claim 3, characterized in that When the random array operation instruction is an increment instruction, the object to be processed includes a sequence number of a slice to be incremented, size information to be incremented, and process information to be incremented; and processing the object to be processed accordingly according to the random array operation instruction includes: Determine a random array to be incremented corresponding to the random array operation instruction; Extracting free item information according to the sequence information recorded in the random array to be added; Using the idle item information to record the sequence number of the slice to be added, the size information to be increased, and the process information to be added; determining whether the increment instruction includes first position information; If yes, then updating the sequence information of the to-be-incremented random array according to the first position information; If not, the sequence information of the to-be-incremented random array is updated according to the historical insertion position recorded in the to-be-incremented random array.

7. The method according to claim 6, characterized in that The performing corresponding processing on the object to be processed according to the out-of-order array operation instruction further includes: If the size information to be increased is a preset value, traverse the item information in the random array to be increased; Determine whether there is a second target item information in the to-be-added random order array that is adjacent to the to-be-added slice sequence number and the same as the to-be-added process information; If yes, then update the second target item information according to the sequence number of the slice to be added and the size information to be increased; If not, extracting the free item information according to the sequence information recorded in the to-be-incremented array is performed.

8. The method according to claim 3, characterized in that When the random array operation instruction is a delete instruction, the object to be processed includes information of items to be deleted; and the corresponding processing of the object to be processed according to the random array operation instruction includes: Determine a random array to be deleted corresponding to the information of the item to be deleted; If the item to be deleted corresponds to the last position of the sequence information of the random array to be deleted, then updating the sequence information according to the item information before the item to be deleted; If the item to be deleted does not correspond to the first or last position of the sequence information of the random array to be deleted, the previous item information of the item to be deleted is used as the adjacent item information of the next item information of the item to be deleted to update the sequence information; Delete the item information to be deleted.

9. The method according to claim 8, characterized in that The random array records aging information, and the aging information is used to point to the item information corresponding to the first position in the sequence information; and the corresponding processing of the object to be processed according to the random array operation instruction further includes: If the item information to be deleted corresponds to the first item of the sequence information of the random array record to be deleted, the aging information is updated according to the next item information of the item information to be deleted in the sequence information.

10. The method according to claim 3, characterized in that When the random array operation instruction is a deletion instruction, the object to be processed includes the second position information, the sequence number of the slice to be deleted, and the size information of the slice to be deleted; and the corresponding processing of the object to be processed according to the random array operation instruction includes: Determining third target item information corresponding to the second location information; When the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information, and the size information to be deleted is smaller than the size information of the third target item information, updating the size information of the third target item information according to the size information to be deleted, and updating the sequence number of the slice of the third target item information; When the sequence number of the slice to be deleted is consistent with the sequence number of the slice of the third target item information, and the size information to be deleted is not less than the size information of the third target item information, deleting the third target item information; When the sequence number of the slice to be deleted is inconsistent with the sequence number of the slice of the third target item information, and the sum of the sequence number of the slice to be deleted and the size information to be deleted is not less than the sum of the sequence number of the slice and the size information of the third target item information, updating the size information of the third target item information according to the size information to be deleted; When the slice sequence number to be deleted is inconsistent with the slice sequence number of the third target item information, and the sum of the slice sequence number to be deleted and the size information to be deleted is less than the sum of the slice sequence number and the size information of the third target item information, determine that the target memory segment corresponding to the third target item information is divided into a first memory segment and a second memory segment that do not correspond to the object to be processed, update the size information of the third target item information according to the described method, and generate an increase instruction for the second memory segment.

11. The method according to claim 9, characterized in that When the random array operation instruction is a scan instruction, the object to be processed includes a random array to be scanned; and the corresponding processing of the object to be processed according to the random array operation instruction includes: Determining a first heat state corresponding to the out-of-order array to be scanned; Scanning the memory segment to be scanned corresponding to the item information in the random array to be scanned; When the slice corresponding to the memory segment to be scanned changes to a second heat state, determining a sequence number of a slice to be moved, size information to be moved, and process information to be moved corresponding to the slice corresponding to the second heat state; Updating the item information corresponding to the sequence number of the slice to be moved, the size information to be moved, and the process information to be moved in the random array to be scanned; The sequence number of the slice to be moved, the size information to be moved, and the process information to be moved are added to the random array corresponding to the second heat state.

12. A processing device with reserved memory, characterized in that: The device comprises: An acquisition module, configured to acquire a preset array set; the array set includes a plurality of random arrays corresponding to a preset heat state of the reserved memory; a determination module, configured to determine a current heat state and characteristic information of a target memory segment in the reserved memory; the characteristic information including slice sequence numbers and size information corresponding to consecutive memory slices in the target memory segment that are in the same heat state; An adding module, configured to add the feature information to a random array corresponding to the current popularity state; Among them, the virtual address of the process corresponding to the memory slice is obtained; If it is a virtualization scenario, determine whether the access bit of its virtualization page table is set based on the virtual address; If the access bit of the virtualized page table is set, the current temperature state corresponding to the memory slice is hot; If the access bit of the virtualized page table is not set, reading the kernel page table of the process; If the access bit of the kernel page table is set, the current heat state corresponding to the memory slice is hot; If the access bit of the kernel page table is not set, the current heat state corresponding to the memory slice is a cold state.

13. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the method for processing reserved memory according to any one of claims 1 to 11 are implemented.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for processing reserved memory according to any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • Memory access information acquisition method, computing device and storage medium

    CN113434371A

  • Method and program product for avoiding cache congestion by offsetting addresses while allocating memory

    US20050091466A1