Memory Mirroring Methods and Computing Devices
By dynamically detecting and setting mirror protection regions in computing devices, the problem of wasted mirror memory is solved, achieving efficient memory utilization and reliable protection of important data.
Patent Information
- Application Number
- CN202111151149.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-07-08
- Filing Date
- 2021-09-29
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2041-09-29
AI Technical Summary
In existing technologies, the setup of mirrored memory leads to wasted memory space, increases memory usage costs, and may not effectively protect the memory areas that need to be mirrored.
During the operation of the computing device, faulty or soon-to-be-faulty areas in memory are dynamically detected, and mirror protection areas are set up for these areas. Data is transferred to the mirror areas, and the addresses and status of the mirror protection areas are managed through a mirror table using mirror memory.
Effective use of mirrored memory reduces memory usage costs and improves the reliability of protection for critical data.
Smart Images

Figure CN115599592B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage, and more particularly to a memory mirroring method and computing device. Background Technology
[0002] During use, some areas of the memory in computing devices may fail, leading to data loss. To ensure the reliability of data for critical applications, mirrored memory is set up for these applications during system startup. After system startup, for critical applications with mirrored memory, the computing device writes data to both regular memory and mirrored memory. This way, if regular memory fails, data can be retrieved from mirrored memory, ensuring the reliability of critical application data. However, the memory areas storing critical applications may not necessarily fail. Therefore, mirrored memory setup wastes memory space and increases memory usage costs. Summary of the Invention
[0003] The memory mirroring method and computing device provided in this application can determine the memory region that needs to be mirrored when the computing device is running, and set up mirror memory for the determined memory region, so as to make full use of the set mirror memory and reduce the cost of memory usage.
[0004] The first aspect of this application provides a memory mirroring method executed by a computing device, the computing device including memory, the method comprising: during the operation of the computing device, determining a mirror protection region in the memory, the mirror protection region being a region that needs to be mirrored; setting a mirror region for the mirror protection region; and transferring data from the mirror protection region to the mirror region.
[0005] Using the method described above, when the computing device is running, it is possible to determine the memory regions that need to be mirrored and set up mirror memory for the determined memory regions, thereby making full use of the set mirror memory and reducing the cost of memory usage.
[0006] In one implementation of the first aspect, during the operation of the computing device, the computing device detects a memory region in the memory that has a fault or error, and uses the detected memory region that has a fault or error as the mirror protection region.
[0007] In one implementation of the first aspect, determining the mirror protection region in the memory during the operation of the computing device includes: during the operation of the computing device, the computing device sets the mirror protection region according to the user's operation.
[0008] In one implementation of the first aspect, when setting a mirror region for the mirror protection region, a mirror region is first allocated to the mirror protection region; then the address of the mirror protection region and the address of the mirror region are recorded in the mirror table.
[0009] In one implementation of the first aspect, transferring the data of the mirrored protected area to the mirrored area includes: copying the data of the mirrored protected area to the mirrored area.
[0010] In one implementation of the first aspect, the method further includes: after copying the data of the mirror protection area to the mirror area, enabling the mirror protection function of the mirror protection area; when receiving an access request to access the mirror protection area, determining whether the mirror protection function of the mirror protection area is valid, and if valid, redirecting the access request to the mirror area.
[0011] In one implementation of the first aspect, the mirror table is provided with a flag bit that enables the mirror protection function of the mirror protection area; when the mirror protection function of the mirror protection area is enabled, the flag bit corresponding to the mirror protection area in the mirror table is set to a valid bit.
[0012] A second aspect of this application provides a computing device comprising several functional modules, each functional module being used to execute the memory mirroring method provided in various implementations of the first aspect.
[0013] A third aspect of this application provides a computing device, the computing device including a processor and a memory, the memory storing program instructions, the processor executing the program instructions to perform the memory mirroring method provided in various implementations of the first aspect.
[0014] A fourth aspect of this application provides a computer-readable storage medium including instructions that, when executed on a computing device, cause the computing device to implement the method provided in any possible implementation of the first aspect. Attached Figure Description
[0015] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly described below.
[0016] Figure 1 This is a hardware architecture diagram of a computing device provided in an embodiment of this application.
[0017] Figure 2 This is a structural diagram of the memory in a computing device provided in an embodiment of this application.
[0018] Figure 3A flowchart of a memory mirroring method provided in an embodiment of this application.
[0019] Figure 4 This is a schematic diagram of a mirror table provided in an embodiment of this application.
[0020] Figure 5 This is a flowchart illustrating the method for processing received read requests after setting a mirror protection region for the mirrored memory region in this embodiment of the application.
[0021] Figure 6 This is a flowchart illustrating the method for processing received write requests after setting a mirror protection region for the mirror memory region in this embodiment of the application.
[0022] Figure 7 A functional block diagram of a computing device provided in an embodiment of this application. Detailed Implementation
[0023] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0024] like Figure 1 The diagram shown is a structural diagram of a computing device 100 provided in an embodiment of this application. The computing device 100 can be any computing device including memory, such as a server, storage device, or terminal device.
[0025] The computing device 100 includes a processor 101, a memory controller 102, a memory 103, a hard disk 104, and a communication interface 105. The memory controller 102 can be integrated into the processor 101 or set up independently of the processor 101. Figure 1The illustration uses a computing device comprising only one processor 101 as an example. However, in practical applications, there can be multiple processors, each corresponding to a memory controller. For example, the computing device may include both a central processing unit (CPU) and a graphics processing unit (GPU). The processor 101 is used to process data access requests from external computing devices (e.g., servers) and also to process access requests generated internally within the computing device 100. For instance, when the processor 101 receives a write data request from another computing device via the communication interface 105, it temporarily stores the data in these write data requests in memory 103. When the total amount of data in memory 103 reaches a certain threshold, the processor 101 writes the data in memory 103 to hard disk 104 for persistent storage. The figure only shows one hard disk 104 as an example, but in practical applications, there can be multiple hard disks. In other embodiments, multiple hard disks can also constitute a storage device connected to the computing device 100.
[0026] Memory 103 refers to the internal memory that directly exchanges data with the processor 101. It can read and write data at any time and at high speed, serving as temporary data storage for the operating system or other running programs. Memory 103 includes at least two types of memory, such as random access memory (RAM) or read-only memory (ROM). For example, the RAM may be dynamic random access memory (DRAM) or storage class memory (SCM). DRAM is a semiconductor memory and, like most random access memory (RAM), is a volatile memory device. SCM is a hybrid storage technology that combines the characteristics of traditional storage devices and RAM. Storage class memory can provide faster read and write speeds than hard drives, but its access speed is slower than DRAM, and it is also cheaper than DRAM. However, DRAM and SCM are only illustrative examples in this embodiment, and memory 103 may also include other random access memories, such as static random access memory (SRAM). Additionally, memory 103 can be a dual in-line memory module (DIMM), i.e., a module composed of dynamic random access memory (DRAM), or a solid-state drive (SSD). In practical applications, computing devices can be configured with multiple memory modules of different types. This embodiment does not limit the number or type of memory. Furthermore, memory 103 can be configured to have a power-saving function. The power-saving function means that when the system experiences a power outage and then power is restored, the data stored in memory 103 will not be lost. Memory with a power-saving function is called non-volatile memory. Memory 103 stores software programs, and processor 101 runs the software programs in memory 103 to provide the functions to be implemented by the software programs.
[0027] In the embodiments of this application, such as Figure 2As shown, the memory 103 is divided into mirror memory 1032 and ordinary memory 1031. The mirror memory 1032 is used to store mirror data of the data in the ordinary memory 1031. In this embodiment of the invention, two methods for setting up mirror memory are provided. One method involves allocating a space in the memory 103 as mirror memory 1032 before the electronic device 100 is used. Specifically, the size and starting address of the mirror area are pre-set in the BIOS. Thus, when the electronic device starts up, it can separate the mirror memory 1031 from the memory 103 by running the BIOS. The mirror memory 1032 set in this way is invisible to the operating system and applications. For example, if the size of the memory 103 is 5GB, and 1GB of it is set as mirror memory 1032, then the memory size seen by the operating system and applications is the size of the ordinary memory 1031, i.e., 4GB. Another method for configuring the mirror memory 1032 is as follows: after the electronic device 100 starts up, mirror memory is requested from the memory space provided for the operating system and applications. Specifically, the operating system responds to the user's mirror memory configuration request and allocates the requested size of memory space from memory 103 as mirror memory 1032. The mirror memory is managed by the memory controller 102. If the electronic device 100 includes multiple processors 101, then the memory controllers 102 corresponding to multiple processors 101 can all manage the mirror memory 1032.
[0028] In this embodiment, during the use of memory 103, processor 101 detects address spaces in memory 103 that have already failed or are about to fail (hereinafter collectively referred to as fault spaces for ease of description), and allocates mirror space from the mirror memory 1032 for the detected fault spaces. This allows for dynamic setting of mirror space for the detected fault spaces, thereby fully utilizing mirror memory 1032 and avoiding waste of mirror memory 1032.
[0029] The specific method for dynamically mirroring memory 103 using computing device 100 will be described below. Figure 3 The flowchart shown is described in detail.
[0030] In step S301, the processor 101 determines the memory region that needs to be mirrored.
[0031] The memory regions requiring memory protection are those that need to be mirrored in the mirrored memory 1032. In this embodiment, there are multiple ways to determine the memory regions requiring mirror protection. One method is for the processor 101 to periodically monitor the memory 103 and identify risky memory regions based on memory reliability indicators (KPIs), such as row errors or bank errors in memory. During analysis, parity checking or error checking and correction techniques are used. ECC (Error Correction and Control) technology detects memory regions with errors. Another approach involves the user specifying memory regions that require mirroring protection. For critical applications, the processor allocates fixed memory regions based on user settings and sets mirror protection for these regions. Yet another approach involves the user setting mirror protection for critical applications; once an application with mirror protection is started, a memory region is allocated to the process executing that application, and this allocated memory region is the one requiring protection. A third approach involves the processor continuously detecting memory regions with errors (e.g., ECC errors) during operation. When the number of errors exceeds a threshold, the processor determines that the memory region requires mirroring protection. In this method, different thresholds can be set for different applications. For critical applications, a lower threshold can be set, such as 3 errors, while for ordinary applications, a higher threshold can be set, such as 5 errors. This allows for the early identification of memory regions requiring mirroring protection for critical applications, thus ensuring the reliability of the data in critical applications.
[0032] In step S302, the processor 101 sets up a mirror region for the memory region that needs to be mirrored.
[0033] After determining the memory region in memory 103 that needs to be mirrored (hereinafter referred to as the mirrored protection region for ease of description), processor 101 can allocate a mirror region corresponding to the mirrored protection region in mirrored memory 1032. In this embodiment of the invention, processor 101 stores the address of the mirrored protection region and the address of the mirror region in a mirror table. The mirror table is as follows: Figure 4As shown, each row of the table represents a mirror entry, and each mirror entry records the address range of the mirror protection region and the address range of the corresponding mirror region. For each address range, the start and end addresses of the range can be further recorded in the table. After determining the mirror protection region in step S301 and setting the mirror region for the mirror protection region, the processor 101 can add a mirror entry to the mirror table to record the mapping between the mirror protection region and the address range of the mirror region. Each row of the mirror table also includes the status of each mirror entry, which includes an invalid status and a valid status. An invalid status indicates that the mirror region of the mirror entry is unavailable, for example, represented by "0", and a valid status indicates that the mirror region of the mirror entry is available, for example, represented by "1". The generation, updating, and use of the mirror entries will be described below.
[0034] In this embodiment, after the processor determines a new mirror protection region, if the remaining space in the mirror memory is insufficient to allocate a mirror region for the mirror protection region, the processor 101 determines the priority of each mirror entry in the mirror table and deletes one or more mirror entries with the lowest priority from the mirror table to release mirror memory space. The priority of a mirror entry can be determined based on the importance of the application using the address space of the mirror protection region of each mirror entry, or it can be determined through…
[0035] In this embodiment, the mirror table can be implemented in two ways: software and hardware. In the software implementation, the processor 101 creates the mirror table in memory 103 during operation. In the hardware implementation, the mirror table is added to the registers of the processor 101. Once the processor 101 determines a mirror protection region, it records the address range of the mirror protection region in the register. After allocating a mirror region for the mirror protection region, the address range of the mirror region is also recorded in the mirror table.
[0036] Step S303: Perform mirroring processing on the data in the mirror protection area.
[0037] In this embodiment, if the mirror protection region is determined through fault monitoring of memory 103, the processor 101 moves the data from the mirror protection region to the mirror region after generating the mirror item. Before the data is successfully moved into the mirror region, the mirror item is marked as invalid; after the data is successfully moved into the mirror region, the mirror item is marked as valid. For mirror items marked as invalid, the data in the corresponding mirror region cannot be accessed.
[0038] For mirroring items set up for critical applications
[0039] The above method allows for the dynamic identification of mirror protection areas during the use of computing devices, and the setting of mirror areas for mirror protection areas, thereby improving the utilization rate of mirror memory.
[0040] The following will be through Figure 5 and Figure 6 The reading and writing of data will be introduced separately.
[0041] like Figure 5 The diagram shown is a flowchart of the method by which the processor 101 processes a read request.
[0042] In step S501, the processor 101 receives a read request, the read request carrying the address of the data to be read.
[0043] In this embodiment of the application, the address of the data to be read is the logical block address (LBA) of the data to be read.
[0044] In step S502, the processor 101 determines whether the read request is hit in memory 103 based on the address of the data to be read.
[0045] To improve data access efficiency, some hot data is cached in memory 103. For hot data cached in memory 103, processor 103 records the correspondence between the data's LBA and memory address. When a read request is received, processor 101 determines whether the data to be read is hit in memory 103 based on the LBA address carried in the request.
[0046] In step S503, if the read request is not found in the memory 103, the processor 101 reads the data to be read from the hard disk.
[0047] In step S504, if the read request is hit in the memory 103, the processor 101 reads the data to be read from the memory 103.
[0048] In step S505, the processor 101 determines whether the data to be read has been successfully read from the memory 103.
[0049] In step S506, if the reading is successful, the processor 101 returns the data to be read.
[0050] In step S507, if the reading fails, the processor 101 determines that the memory address corresponding to the data to be read has a mirroring function.
[0051] If the read fails, the processor 101 will look up the memory address in the mirror table. If the mirror protection region where the memory address falls is found in the mirror table, and the status of the mirror entry where the mirror protection region is located is marked as valid, then the memory address is determined to have mirroring function.
[0052] Step S508: If a mirroring function is enabled, the processor 101 reads the data to be read from the mirror address corresponding to the memory address.
[0053] When it is determined that the mirror item where the memory address is located has a mirror function, the processor further determines the mirror address corresponding to the memory address, and then reads the data to be read from the mirror address.
[0054] In step S509, if the mirroring function is not set, the read failure will be returned.
[0055] like Figure 6 The diagram shown is a flowchart of the method by which the processor 101 processes a write request.
[0056] In step S601, the processor 101 receives a write request, which carries data to be written.
[0057] In step S602, processor 101 allocates a memory address for the write request.
[0058] In step S603, the processor determines whether the allocated memory address has a mirroring function.
[0059] Step 604: If the allocated memory address has a mirroring function, the processor 101 writes the data to be written to the memory address and the corresponding mirror address.
[0060] Step 605: If the allocated memory address does not have a mirroring function, then write the data to be written to the memory address.
[0061] like Figure 7 The diagram shown is a functional block diagram of a computing device 700 provided in an embodiment of this application. The computing device 700 includes a determining module 701 and a mirroring module 702. The determining module 701 is used to determine the memory regions that need to be mirrored. For the specific determination method, please refer to the description of step S301. The mirroring module 702 is used to set a mirror region for the memory regions that need to be mirrored and to perform mirroring processing on the data in the mirrored protection region. For the specific methods of setting the mirror region and performing mirroring processing on the data in the mirrored protection region, please refer to the detailed descriptions of steps S302 and S303. In addition, the mirroring processing performed by the mirroring module 702 also includes processing read requests and write requests; please refer to [the relevant documentation / reference needed]. Figure 5 and Figure 6Related descriptions.
[0062] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A memory mirroring method, performed by a computing device, the computing device comprising a memory, the method comprising: The method includes: During the operation of the computing device, the computing device detects memory regions in the memory that have faults and errors, and uses the detected memory regions that have faults and errors as mirror protection regions, which are regions that need to be mirrored and protected. Set a mirror region for the mirror protection region; The data in the mirrored protected area is transferred to the mirrored area.
2. The method of claim 1, wherein, Determining the mirror protection region in memory during the operation of the computing device includes: during the operation of the computing device, the computing device sets the mirror protection region according to the user's operation.
3. The method according to any one of claims 1 or 2, characterized in that, Setting a mirror region for the mirror protection area includes: Assign a mirror region to the mirror protection region; Record the address of the mirror protection area and the address of the mirror area in the mirror table.
4. The method according to any one of claims 1 to 3, characterized in that, The step of transferring data from the mirrored protected area to the mirrored area includes: Copy the data from the mirrored protected area to the mirrored area.
5. The method of claim 4, wherein, The method further includes: After copying the data from the mirror protection area to the mirror area, enable the mirror protection function of the mirror protection area; When an access request to the mirror protection area is received, it is determined whether the mirror protection function of the mirror protection area is effective. If it is effective, the access request is redirected to the mirror area.
6. The method of claim 4, wherein, The mirror table is configured with a flag bit that enables the mirror protection function of the mirror protection area; Enabling the mirror protection function of the mirror protection area includes: Set the flag bit corresponding to the mirror protection area in the mirror table to a valid bit.
7. A computing device comprising: The determination module is used to detect memory regions in memory that have faults and errors, and to designate the detected memory regions with faults and errors as mirror protection regions, wherein the mirror protection regions are regions that need to be mirrored and protected. The mirroring module is used to set up a mirror area for the mirror protection area and transfer the data of the mirror protection area to the mirror area.
8. The computing device of claim 7, wherein, During the operation of the computing device, when the determining module determines the mirror protection area in the memory, it is specifically used to: during the operation of the computing device, the computing device sets the mirror protection area according to the user's operation.
9. The computing device of any of claims 7 or 8, wherein, The mirror module is specifically used for: Assign a mirror region to the mirror protection region; Record the address of the mirror protection area and the address of the mirror area in the mirror table.
10. The computing device of any of claims 7-9, wherein, The mirror module is specifically used for: Copy the data from the mirrored protected area to the mirrored area.
11. The computing device as claimed in claim 10, characterized in that, The mirroring module is also used for: After copying the data from the mirror protection area to the mirror area, enable the mirror protection function of the mirror protection area; When an access request to the mirror protection area is received, it is determined whether the mirror protection function of the mirror protection area is effective. If it is effective, the access request is redirected to the mirror area.
12. The computing device as claimed in claim 11, characterized in that, The mirror table is configured with a flag bit that enables the mirror protection function of the mirror protection area; When the mirror module enables the mirror protection function of the mirror protection area, it is specifically used for: Set the flag bit corresponding to the mirror protection area in the mirror table to a valid bit.
Citation Information
Patent Citations
Memory Apparatus Memory Module And Semiconductor System Capable Of Dynamically Mirroring
CN108279998A
Utilizing A Potentially Unreliable Memory Module For Memory Mirroring In A Computing System
US20090150721A1
