Standby power management method, device and equipment for storage system

By detecting power outage in the storage system, the memory page to be dumped is obtained and the multi-threaded kernel binding method is used to write it to nonvolatile memory, the problem of data loss in the storage system when power outage is solved, and the rapid and secure data drop is achieved, and the system reliability is improved.

CN119718045AActive Publication Date: 2025-03-28INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411998342.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-03-28
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

When the storage system runs IO services, the data in the main memory is easily lost in the event of a sudden power outage. The existing technology relies on BBU to provide backup power, but its power is limited and cannot be quickly dropped, resulting in lost service data.

Method used

By detecting that the system is powered down, the memory page to be dumped is obtained, and the preset thread is used to write it to the preset dump file and store it in nonvolatile memory. This method includes a multi-threaded core binding method, using the computing power of the central processor and the bandwidth of the nonvolatile memory to quickly and safely land the disk.

Benefits of technology

It realizes the rapid and safe way to put the memory data of the storage system into non-volatile memory when the system is powered down, avoiding loss of business data and improving the reliability of the storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718045A_ABST
    Figure CN119718045A_ABST
Patent Text Reader

Abstract

The invention discloses a standby power management method, device and equipment for a storage system, and relates to the technical field of storage systems.The method comprises the steps that when power failure of the system is detected, a to-be-dumped memory page is obtained; wherein the memory page to be dumped comprises a platform memory management memory page and a non-platform memory management memory page; determining a to-be-dumped memory page corresponding to each preset thread; writing the memory page to be dumped into a preset dump file by utilizing a preset thread, and storing the preset dump file into a nonvolatile memory; by setting the preset dump file, the service data cached by the storage system is stored in the corresponding area in the preset dump file, so that the data can be conveniently and quickly written and read; and through a multi-thread core binding mode, the computing power and the storage bandwidth of the central processing unit can be fully utilized, the data in the memory of the storage system can be quickly and safely dropped into the nonvolatile memory, the condition of business data loss is avoided, and the reliability of the storage system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of storage systems, and in particular to a backup power management method, device and equipment for a storage system. Background Art

[0002] At present, when the storage system is running IO (input / output) business, the carrier of cached data is the main memory of the storage device, and the main memory uses volatile memory, so the data in the main memory (i.e., internal memory) will be lost when there is a sudden power outage. In order to ensure that IO data is not lost, additional technical means are needed to protect the data during power outages so that the business can continue when the computer is turned on next time. Although non-volatile main memory technology has been developed in related technologies, it is not yet widely popularized due to comprehensive considerations of multiple factors such as cost and technical maturity.

[0003] The mainstream approach in current storage systems is to use BBU (Battery Backup Unit) to provide backup power. For example, when the power of the storage system is cut off, the CPLD (Complex Programmable Logic Device) on the controller switches the circuit breaker to the BBU, which is powered by the BBU, and the cached data in the memory is backed up to the system disk for restoration to the memory at the next power-on. However, after the IO business of the storage system is running, up to 100GB of business data may be generated, and the power that the BBU can provide is limited. If the cached business data cannot be quickly written to the system disk, business data loss will occur. Therefore, how to quickly and safely write the data in the memory of the storage system to the non-volatile memory to avoid business data loss and improve the reliability of the storage system is an urgent problem to be solved today. Summary of the invention

[0004] The purpose of the present invention is to provide a backup power management method, device and equipment for a storage system, so as to quickly and safely store data in the memory of the storage system into a non-volatile memory, avoid business data loss, and improve the reliability of the storage system.

[0005] In order to solve the above technical problems, the present invention provides a backup power management method for a storage system, comprising:

[0006] When a system power failure is detected, a memory page to be dumped is obtained; wherein the memory page to be dumped includes a platform memory management memory page and a non-platform memory management memory page;

[0007] Determine the memory pages to be dumped corresponding to each preset thread; wherein the number of the preset threads is greater than or equal to 2, and different preset threads are each bound to a different central processing unit core;

[0008] The preset thread is used to write the memory pages to be dumped into a preset dump file, and the preset dump file is stored in a non-volatile memory; wherein the preset dump file includes a file header, data of each memory page to be dumped, a logical page number and virtual memory address information.

[0009] On the other hand, the absolute value of the difference between the numbers of memory pages to be dumped corresponding to any two of the preset threads is less than or equal to 1.

[0010] On the other hand, determining the memory pages to be dumped corresponding to each preset thread includes:

[0011] Obtaining the logical page number of each of the memory pages to be dumped; wherein the logical page number of the platform memory management memory page is the platform memory management page number, and the logical page number of the non-platform memory management memory page is a page number outside the platform memory management page number range;

[0012] According to the sequence of the logical page numbers, the corresponding memory pages to be dumped are allocated to each of the preset threads in turn.

[0013] On the other hand, the preset dump file includes a file header area, a memory page area, a logical page number area and a virtual memory area, and the using of the preset thread to write the memory page to be dumped into the preset dump file, and storing the preset dump file in a non-volatile memory includes:

[0014] Using the dump main thread to open the preset dump file in the non-volatile memory;

[0015] Using the dump main thread to write the file header area of ​​the preset dump file; wherein the file header area includes a header area and a tail area, the header area and the tail area are both used to store the same file header, and the file header includes the signature, type, number of memory page areas and number of virtual memory areas of the preset dump file;

[0016] Using each of the preset threads to write the corresponding memory page areas in the preset dump file; wherein each of the memory page areas is used to store data of a corresponding memory page to be dumped;

[0017] Using the dump main thread to write the logical page number area in the preset dump file; wherein each of the logical page number areas is used to store the logical page number and data check code of a corresponding memory page to be dumped;

[0018] The virtual memory area in the preset dump file is written by using the dump main thread; wherein each of the virtual memory areas is used to store the virtual memory address information and virtual memory address check code of a corresponding memory page to be dumped;

[0019] The file header area is rewritten using the dump main thread, and the preset dump file is closed.

[0020] On the other hand, the method of using the preset thread to write the memory page to be dumped into a preset dump file and storing the preset dump file in a non-volatile memory includes:

[0021] When writing data to the preset dump file, starting the timing of the kernel timer;

[0022] If the timing time of the kernel timer reaches a time threshold, the storage system is controlled to shut down.

[0023] On the other hand, when the system power failure is detected, obtaining the memory page to be dumped includes:

[0024] When it is detected that the service main process of the storage system exits, the memory page to be dumped is locked by using the dump main thread;

[0025] After using the preset thread to write the memory page to be dumped into a preset dump file and storing the preset dump file in a non-volatile memory, the method further includes:

[0026] The memory page to be dumped is unlocked by utilizing the dump main thread.

[0027] On the other hand, after using the preset thread to write the memory page to be dumped into a preset dump file and storing the preset dump file in a non-volatile memory, the method further includes:

[0028] After detecting that the system is powered on, the preset thread is used to restore the data of the memory page to be dumped in the preset dump file to the memory of the storage system.

[0029] On the other hand, when the system power failure is detected, before obtaining the memory page to be dumped, the method further includes:

[0030] Determining a target number according to the number of CPU cores of the storage system and the bandwidth of the non-volatile memory;

[0031] Creating the target number of preset threads, and binding each of the preset threads to a corresponding central processing unit core;

[0032] Using the thread-specific data, a space of a preset size is reserved for each of the preset threads.

[0033] The present invention also provides a storage system backup power management device, comprising:

[0034] A power-off acquisition module, used to acquire memory pages to be dumped when a system power-off is detected; wherein the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages;

[0035] A thread allocation module, used to determine the memory pages to be dumped corresponding to each preset thread; wherein the number of the preset threads is greater than or equal to 2, and different preset threads are each bound to a different central processing unit core;

[0036] The data disk module is used to use the preset thread to write the memory pages to be dumped into the preset dump file, and store the preset dump file in the non-volatile memory; wherein the preset dump file includes a file header, the data of each memory page to be dumped, the logical page number and the virtual memory address information.

[0037] In addition, the present invention also provides a storage system backup power management device, including:

[0038] Memory for storing computer programs;

[0039] The processor is used to implement the steps of the backup power management method of the storage system as described above when executing the computer program.

[0040] A backup power management method for a storage system provided by the present invention comprises: when a system power failure is detected, obtaining a memory page to be dumped; wherein the memory page to be dumped comprises a platform memory management memory page and a non-platform memory management memory page; determining the memory page to be dumped corresponding to each preset thread; wherein the number of preset threads is greater than or equal to 2, and different preset threads are respectively bound to a different central processing unit core; using the preset threads, writing the memory page to be dumped into a preset dump file, and storing the preset dump file in a non-volatile memory; wherein the preset dump file comprises a file header, data of each memory page to be dumped, a logical page number and virtual memory address information.

[0041] It can be seen that the present invention can store the business data cached by the storage system into the corresponding area of ​​the preset dump file when the system loses power through the setting of the preset dump file, so as to facilitate the rapid writing and reading of data; and through the multi-threaded core binding method, it can give full play to the computing power of the central processing unit as much as possible, and give full play to the bandwidth of the non-volatile memory, so as to quickly and safely drop the data in the memory of the storage system into the non-volatile memory, avoid the loss of business data, and improve the reliability of the storage system. In addition, the present invention also provides a backup power management device and equipment for the storage system, which also has the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0043] Figure 1 A flowchart of a backup power management method for a storage system provided by an embodiment of the present invention;

[0044] Figure 2 A schematic diagram of the architecture of another storage system backup power management method provided by an embodiment of the present invention;

[0045] Figure 3 A schematic diagram of a format of a preset dump file provided by an embodiment of the present invention;

[0046] Figure 4 A schematic diagram of a mapping relationship between memory pages and threads provided by an embodiment of the present invention;

[0047] Figure 5 A structural block diagram of a backup power management device for a storage system provided in an embodiment of the present invention

[0048] Figure 6 A simplified structural diagram of a backup power management device for a storage system provided by an embodiment of the present invention;

[0049] Figure 7 A schematic diagram of the specific structure of a backup power management device for a storage system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] Please refer to Figure 1 , Figure 1 A flowchart of a method for managing power backup of a storage system provided by an embodiment of the present invention. The method may include:

[0052] Step 101: when a system power failure is detected, memory pages to be dumped are obtained; wherein the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages.

[0053] It can be understood that the memory page to be dumped in this embodiment can be a memory page (page) that needs to be protected in the memory of the storage system (such as a storage device), such as the memory page of PLMM (Platform Memory Management, platform memory management) (i.e., PLMM memory page) and the general memory page other than the memory page of PLMM (i.e., non-PLMM memory page). Among them, PLMM is mainly used to provide memory allocation, management, release and copy operations for the business of the storage system; the kernel state provides a PLMM Misc (miscellaneous) device by PLMM, and a large section of memory will be locked for use by the PLMM module during the initialization process. The user state uses the PLMM function provided by the kernel to interact with the PLMM device.

[0054] Correspondingly, when the processor in the storage system of this embodiment detects that the system is powered off, the specific method of obtaining the memory page to be dumped can be set by the designer according to practical scenarios and user needs. For example, the processor can use the dump main thread (such as Figure 2 The Dump main thread in the storage system locks (pins) the memory page to be dumped when a power failure is detected in the system (such as the exit of the main business process of the storage system) to prevent the loss of IO business data. Accordingly, the processor can use the dump main thread to unlock (unpin) the memory page to be dumped after writing the memory page to be dumped into the preset dump file. For example, since the PLMM memory page can achieve a similar locking effect through the management of the PLMM, the dump main thread is used in this step to lock the memory page (that is, the non-PLMM memory page) being used by the main business process of the storage system when the main business process exits, so as to prevent the operating system from swapping out the process page and causing the loss of IO business data. That is, the dump main thread can immediately lock the non-PLMM managed memory page that needs to be dumped when a power failure is sensed, and the dump main thread can also terminate or block other threads except the Dump management (such as the preset thread) to release computing resources and prepare for writing the preset dump file.

[0055] Among them, the specific data content of the memory page to be dumped in this embodiment can be set according to practical scenarios and user needs. For example, it can be set in the same or similar manner as the data content of the memory page managed by PLMM and the memory page not managed by PLMM in the storage system in the related art. For example, the memory page to be dumped can be Figure 3The Pagecontent area shown is the data written to the preset dump file (such as Dump file) in units of memory pages (4k); for example, non-PLMM memory pages can represent general memory, which can include data segments, BSS segments (BSS segments, a memory area used to store uninitialized global variables in the program), stacks, driver registered memory, memory allocated through libc (Standard C library, a function library) interface, and memory allocated by third-party libraries.

[0056] Step 102: Determine the memory pages to be dumped corresponding to each preset thread; wherein the number of preset threads is greater than or equal to 2, and different preset threads are respectively bound to a different CPU core.

[0057] It can be understood that the preset thread in this embodiment can be a preset thread used to write the corresponding memory pages to be dumped into the preset dump file, such as Figure 2 In this embodiment, each preset thread can be bound to a different CPU (central processing unit) core, that is, different command queues are assigned to different preset threads, and each command queue is bound to a specific CPU core, thereby reducing the overhead of cross-core scheduling. Different command queues can provide low-latency I / O paths, reducing the time from submitting a command to receiving a completion notification.

[0058] Correspondingly, the specific number of preset threads in this embodiment can be set by the designer or user according to the usage scenario and user needs. For example, the number of preset threads can be a value configured by the designer or user or a fixed value; the number of preset threads can also be a value calculated and determined by the processor of the storage system. This embodiment does not impose any restrictions on this.

[0059] Among them, the method provided in this embodiment may also include a process of creating a preset thread, such as the processor can determine the target number according to the number of CPU cores of the storage system and the bandwidth of the non-volatile memory (such as parameters such as data block size and the number of hard disk command queues); create a target number of preset threads, and bind a corresponding CPU core to each preset thread; use thread-specific data to reserve a preset size of space for each preset thread. For example, in a production environment, the optimal parameters of the data drop rate of the system disk (i.e., non-volatile memory) are tested for storage devices with different models and configurations, mainly involving the number of Dump read and write threads (i.e., preset threads), the size of the written data blocks, and the number of hard disk command queues, etc. The parameters are saved in a file, and these parameters are read before writing the preset dump file to create a target number of preset threads. The processor can regularly evaluate the performance of the system disk and adjust the parameters to achieve the best write performance; if the time cost of the parameter adjustment algorithm is high, an additional command line can also be provided to provide write parameter adjustments within a specified range to reduce the time cost of algorithm optimization; for example, the processor can select a target number from the preset thread range according to the data block size of the system disk and the number of hard disk command queues; further, Figure 2 As shown, the processor can also use the dump main thread (Dump main thread) to select a target number from the preset thread range according to the number of memory pages queried (i.e., the number of memory pages to be dumped), the data block size written to the system disk, and the number of hard disk command queues, so as to create a preset thread with reference to the number of memory pages, thereby improving the accuracy of the number of preset threads.

[0060] Correspondingly, such as Figure 2 As shown in the figure, when the target number is 8, 8 different CPU cores can be bound to the 8 preset threads of dump management created, and 1M (i.e. 1MB) of space can be reserved for each preset thread using TSD (Thread-Specific Data). Up to 8 preset threads can be used for parallel writing at the same time, which can reduce memory contention, improve thread switching efficiency, simplify memory management, enhance data security, and optimize cache performance.

[0061] It should be noted that, in this embodiment, any two preset threads will not correspond to the same memory page to be dumped. For the specific manner in which the processor determines the memory page to be dumped corresponding to each preset thread in this embodiment, it can be set by the designer according to the usage scenario and user needs. For example, in order to evenly distribute the memory page to be dumped to each preset thread as much as possible, the absolute value of the difference between the number of memory pages to be dumped corresponding to any two preset threads in this embodiment is less than or equal to 1, that is, the number of memory pages to be dumped corresponding to any two preset threads differs by 1 at most, so as to ensure the balance of the memory pages to be dumped allocated to each preset thread. For example, in this step, the processor can allocate the corresponding memory page to be dumped to each preset thread according to the number of memory pages to be dumped and the number of preset threads. The processor can also obtain the logical page number of each memory page to be dumped; wherein the logical page number of the platform memory management memory page is the platform memory management page number, and the logical page number of the non-platform memory management memory page is a page number outside the platform memory management page number range, that is, the page number is allocated to the non-PLMM memory page from outside the page number range used by the PLMM; according to the order of the logical page numbers, the corresponding memory page to be dumped is allocated to each preset thread in turn.

[0062] For example, the dump master thread can determine the total number of memory pages that need to be written into the preset dump file (i.e., the memory pages to be dumped), and distribute these pages to each preset thread as evenly as possible in the order of page numbers according to the number of preset threads, so that each preset thread writes the memory pages allocated to itself into the specified preset dump file. Figure 4 As shown, when 20 memory pages to be dumped (memory pages 1-20) are allocated to 8 preset threads (threads 1-8), the first 4 preset threads (threads 1-4) can be allocated to 3 memory pages to be dumped respectively, and the last 4 preset threads (threads 1-4) can be allocated to 2 memory pages to be dumped respectively.

[0063] Step 103: Using a preset thread, write the memory pages to be dumped into a preset dump file, and store the preset dump file in a non-volatile memory; wherein the preset dump file includes a file header, data of each memory page to be dumped, a logical page number, and virtual memory address information.

[0064] It is understandable that the preset dump file in this embodiment can be a pre-set file for storing memory pages to be dumped, such as a Dump file. In this embodiment, by setting the preset dump file, the business data cached by the storage system can be stored in the corresponding area of ​​the preset dump file when the system loses power, which facilitates the rapid writing and reading of data.

[0065] Correspondingly, the specific format of the preset dump file in this embodiment can be set by the designer according to the usage scenario and user needs. For example, the preset dump file includes a file header area for storing a file header (such as Figure 3 header in), the memory page area used to store the data of each memory page to be dumped (such as Figure 3 The Page content area in the dump), the logical page number area for storing the logical page number of each memory page to be dumped (such as Figure 3 The page indexarea in the dump) and the virtual memory area used to store the virtual memory address information of each memory page to be dumped (such as Figure 3 VMA area in the file); wherein the file header area may include a header area and a tail area, both of which are used to store the same file header, the file header including the signature, type, number of memory page areas and number of virtual memory areas of the preset dump file; each memory page area is used to store data of a corresponding memory page to be dumped (such as Figure 3 4K data in Figure 2 As shown, the data of the non-PLMM memory page (general memory) may not include the code segment.

[0066] Correspondingly, each logical page number area is used to store the logical page number of a corresponding memory page to be dumped. In order to ensure the accuracy of restoring the memory page to be dumped, each logical page number area can also be used to store a check code (i.e., data check code) of a corresponding memory page to be dumped, such as an LRC (Longitudinal Redundancy Check) check code; for example, all logical page number areas in the preset dump file can be understood as an array, and each logical page number area can be understood as an element, carrying the logical page number and the data check code, which is used to describe the page number of the corresponding page page (i.e., the memory page to be dumped) and the check code of 4k data. Each virtual memory area can be used to store the virtual memory address information of a corresponding memory page to be dumped, and accordingly, can also be used to store the check code of the respective virtual memory address information (i.e., virtual memory address check code), such as LRC (Longitudinal Redundancy Check) check code; the virtual memory address information may include the virtual address, length and iob number (i.e., the serial number in the PLMM IOBtable table), which respectively describe the starting address, length and iob number of the memory region.

[0067] Among them, this embodiment does not limit the specific number of preset dump files. For example, the number of preset dump files can be 1, that is, each memory page to be dumped can be written to the same preset dump file; the number of preset dump files can also be greater than or equal to 2, such as the number of preset dump files can be the same as the number of preset threads, that is, each preset thread can write all corresponding memory pages to be dumped into one corresponding preset dump file, such as Figure 3 As shown, 8 preset threads can correspond to 8 preset dump files.

[0068] Correspondingly, the specific method in which the processor uses the preset thread in this step to write the memory pages to be dumped into the preset dump file, and stores the preset dump file in the non-volatile memory can be set by the designer. For example, the memory pages to be dumped can be directly written into the preset dump file in the non-volatile memory (such as the system disk) to reduce the transfer process of the preset dump file.

[0069] Similarly, this embodiment does not limit the specific process of writing the memory page to be dumped into the preset dump file by using the preset thread. For example, since the writing process of the content other than the data of the memory page to be dumped occupies a relatively limited space, it can be written by the dump main thread; and in order to ensure the integrity of the data of the preset dump file, LRC can be used for verification to ensure that the complete memory page to be dumped can be read and restored during reading; and in order to speed up the writing speed, the timestamp update can be disabled.

[0070] For example, if Figure 2 As shown, in this step, the processor can use the dump main thread to open the preset dump file (dump file) in the non-volatile memory; use the dump main thread to write the file header area (dump header) of the preset dump file; wherein the file header area includes a header area and a tail area, and the header area and the tail area are both used to store the same file header, and the file header includes the signature, type, number of memory page areas and number of virtual memory areas of the preset dump file; use each preset thread to write the corresponding memory page area in the preset dump file respectively; wherein each memory page area is used to store the data of a corresponding memory page to be dumped (plmm is required to manage memory pages and general memory); use the dump main thread to write the logical page number area (page index) in the preset dump file; wherein each logical page number area is used to store the logical page number and data check code of a corresponding memory page to be dumped; use the dump main thread to write the virtual memory area (vma index); wherein each virtual memory area is used to store the virtual memory address information and virtual memory address check code of a corresponding memory page to be dumped; the file header area is rewritten using the dump main thread, and the preset dump file is closed.

[0071] Furthermore, in order to avoid unexpected situations that damage the BBU of the storage system, the processor in this embodiment can start the timing of the kernel timer when writing data to the preset dump file; if the timing time of the kernel timer reaches the time threshold, the storage system is controlled to shut down. That is to say, in this embodiment, the kernel timer (such as watchdog, a timer) can be started when writing data to the preset dump file, and the response action after the kernel timer expires can be registered. If the data is written to the disk before the kernel timer expires, the system will shut down normally. If the data is not written to the disk after the kernel timer expires, the system will be forced to shut down. Before shutting down, the locked memory pages (such as non-PLMM memory pages) should be released. The watchdog is introduced to prevent unexpected situations from draining the BBU power without limit and damaging the BBU. The time threshold of the kernel timer can be 200 seconds or other time, and this embodiment does not impose any restrictions on this.

[0072] It is understandable that, in this embodiment, step 103 may also include a process of restoring the memory page to be dumped using a preset dump file after the system is powered on. For example, the processor may detect that after the system is powered on, the data of the memory page to be dumped in the preset dump file may be restored to the memory of the storage system using a preset thread.

[0073] Correspondingly, in this embodiment, after detecting that the system is powered on, the specific method of using the preset thread to restore the data of the memory page to be dumped in the preset dump file to the memory of the storage system can be set by the designer. For example, it can be set in a corresponding manner corresponding to the writing process of the above-mentioned preset dump file; for example, when the preset dump file sets a check code (such as an LRC check code), the memory page in the preset dump file can be mapped to the corresponding process space address after the LRC check is passed, so as to realize the recovery of the cached data of the storage system; for example, when the dump is restored, each preset thread reads the part written by itself, and maps the memory page to the corresponding process space address after passing the LRC check.

[0074] In this embodiment, the embodiment of the present invention can store the business data cached by the storage system into the corresponding area of ​​the preset dump file when the system loses power through the setting of the preset dump file, so as to facilitate the rapid writing and reading of data; and through the multi-threaded core binding method, it can maximize the computing power of the central processing unit and give full play to the bandwidth of the non-volatile memory, reduce the requirements for the BBU battery capacity, and reduce the hardware cost, so as to quickly and safely put the data in the memory of the storage system into the non-volatile memory, avoid the loss of business data, and improve the reliability of the storage system.

[0075] Corresponding to the above method embodiment, an embodiment of the present invention further provides a backup power management device for a storage system. The backup power management device for a storage system described below and the backup power management method for a storage system described above can refer to each other.

[0076] Please refer to Figure 5 , Figure 5 This is a structural block diagram of a backup power management device for a storage system provided in an embodiment of the present invention. The device may include:

[0077] A power-off acquisition module 10 is used to acquire memory pages to be dumped when a power-off of the system is detected; wherein the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages;

[0078] The thread allocation module 20 is used to determine the memory pages to be dumped corresponding to each preset thread; wherein the number of preset threads is greater than or equal to 2, and different preset threads are each bound to a different CPU core;

[0079] The data disk module 30 is used to write the memory pages to be dumped into the preset dump file using the preset thread, and store the preset dump file in the non-volatile memory; wherein the preset dump file includes a file header, the data of each memory page to be dumped, the logical page number and the virtual memory address information.

[0080] On the other hand, an absolute value of a difference between the numbers of to-be-dumped memory pages corresponding to any two preset threads is less than or equal to 1.

[0081] In another aspect, the thread allocation module 20 may include:

[0082] A page number acquisition submodule is used to acquire the logical page number of each memory page to be dumped; wherein the logical page number of the platform memory management memory page is the platform memory management page number, and the logical page number of the non-platform memory management memory page is a page number outside the platform memory management page number range;

[0083] The allocation submodule is used to allocate the corresponding memory pages to be dumped to each preset thread in sequence according to the order of logical page numbers.

[0084] On the other hand, the preset dump file includes a file header area, a memory page area, a logical page number area and a virtual memory area, and the data storage module 30 may include:

[0085] An opening submodule is used to open a preset dump file in a non-volatile memory by using a dump main thread;

[0086] A file header submodule is used to write a file header area of ​​a preset dump file using a dump main thread; wherein the file header area includes a header area and a tail area, both of which are used to store the same file header, and the file header includes a signature, a type, a number of memory page areas, and a number of virtual memory areas of the preset dump file;

[0087] The memory page submodule is used to use each preset thread to write the corresponding memory page area in the preset dump file; wherein each memory page area is used to store the data of a corresponding memory page to be dumped;

[0088] The page number submodule is used to write the logical page number area in the preset dump file by using the dump main thread; wherein each logical page number area is used to store the logical page number and data check code of a corresponding memory page to be dumped;

[0089] The virtual memory submodule is used to write the virtual memory area in the preset dump file by using the dump main thread; wherein each virtual memory area is used to store the virtual memory address information and virtual memory address check code of a corresponding memory page to be dumped;

[0090] The rewrite close submodule is used to use the dump main thread to rewrite the file header area and close the preset dump file.

[0091] In another aspect, the data storage module 30 may include:

[0092] The timing submodule is used to start the timing of the kernel timer when writing data to the preset dump file;

[0093] The forced shutdown submodule is used to control the storage system to shut down if the timing of the kernel timer reaches a time threshold.

[0094] In another aspect, the power-off acquisition module 10 may include:

[0095] The locking submodule is used to lock the memory page to be dumped by using the dump main thread when detecting that the main business process of the storage system has exited;

[0096] The device may also include:

[0097] The unlocking module is used to unlock the memory page to be dumped by using the dump main thread after writing the memory page to be dumped into the preset dump file by using the preset thread and storing the preset dump file in the non-volatile memory.

[0098] In another aspect, the apparatus may further include:

[0099] The recovery module is used to detect that the system is powered on and, using a preset thread, recover the data of the memory page to be dumped in the preset dump file to the memory of the storage system.

[0100] In another aspect, the apparatus further comprises:

[0101] A determination module, used for determining a target quantity according to the number of central processing unit cores of the storage system and the bandwidth of the non-volatile memory;

[0102] A creation module is used to create a target number of preset threads and bind each preset thread to a corresponding central processing unit core;

[0103] The reservation module is used to reserve a space of a preset size for each preset thread by using thread-specific data.

[0104] In this embodiment, the embodiment of the present invention can store the business data cached by the storage system into the corresponding area of ​​the preset dump file when the system loses power through the setting of the preset dump file, so as to facilitate the rapid writing and reading of data; and through the multi-threaded core binding method, it can maximize the computing power of the central processing unit and give full play to the bandwidth of the non-volatile memory, so as to quickly and safely drop the data in the memory of the storage system into the non-volatile memory, avoid the loss of business data, and improve the reliability of the storage system.

[0105] Corresponding to the above method embodiment, an embodiment of the present invention further provides a backup power management device for a storage system. The backup power management device for a storage system described below and the backup power management method for a storage system described above can refer to each other.

[0106] Please refer to Figure 6 , Figure 6 A simplified structural diagram of a backup power management device for a storage system provided by an embodiment of the present invention. The device may include:

[0107] A memory D1, for storing computer programs;

[0108] The processor D2 is used to implement the steps of the storage system backup power management method provided by the above method embodiment when executing a computer program.

[0109] Accordingly, please refer to Figure 7 , Figure 7A schematic diagram of the specific structure of a backup power management device for a storage system provided in an embodiment of the present invention. The backup power management device 310 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 322 (for example, one or more processors) and a memory 332, and one or more storage media 330 (for example, one or more mass storage devices) storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 may be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the host. Furthermore, the central processor 322 may be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the backup power management device 310.

[0110] The backup power management device 310 may further include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Linux system.

[0111] The backup power management device 310 in this embodiment may specifically be a storage device or a server.

[0112] The steps in the power backup management method of the storage system described above can be implemented by the structure of the power backup management device of the storage system.

[0113] Corresponding to the above method embodiment, an embodiment of the present invention further provides a computer program product. The computer program product described below and the backup power management method of a storage system described above can be referred to in correspondence with each other.

[0114] A computer program product includes a computer program / instruction, which, when executed by a processor, implements the steps of the method for managing backup power supply of a storage system provided in the above method embodiment.

[0115] Corresponding to the above method embodiment, an embodiment of the present invention further provides a computer-readable storage medium. The computer-readable storage medium described below and the backup power management method of a storage system described above can be referred to each other.

[0116] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for managing backup power supply of a storage system in the above method embodiment are implemented.

[0117] The computer-readable storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which can store program codes.

[0118] The various embodiments in the 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 referred to each other. For the devices, equipment, computer program products and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0119] The above is a detailed introduction to the backup power management method, device and equipment of a storage system provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the present invention.

Claims

1. A method for managing backup power of a storage system, characterized in that: include: When a system power failure is detected, a memory page to be dumped is obtained; wherein the memory page to be dumped includes a platform memory management memory page and a non-platform memory management memory page; Determine the memory pages to be dumped corresponding to each preset thread; wherein the number of the preset threads is greater than or equal to 2, and different preset threads are each bound to a different central processing unit core; The preset thread is used to write the memory pages to be dumped into a preset dump file, and the preset dump file is stored in a non-volatile memory; wherein the preset dump file includes a file header, data of each memory page to be dumped, a logical page number and virtual memory address information.

2. The method for managing backup power of a storage system according to claim 1, characterized in that: The absolute value of the difference between the numbers of memory pages to be dumped corresponding to any two of the preset threads is less than or equal to 1.

3. The backup power management method for a storage system according to claim 2, characterized in that: Determining the memory pages to be dumped corresponding to each preset thread includes: Obtaining the logical page number of each of the memory pages to be dumped; wherein the logical page number of the platform memory management memory page is the platform memory management page number, and the logical page number of the non-platform memory management memory page is a page number outside the platform memory management page number range; According to the sequence of the logical page numbers, the corresponding memory pages to be dumped are allocated to each of the preset threads in turn.

4. The method for managing backup power of a storage system according to claim 1, characterized in that: The preset dump file includes a file header area, a memory page area, a logical page number area and a virtual memory area, and the method of using the preset thread to write the memory page to be dumped into the preset dump file and storing the preset dump file in a non-volatile memory includes: Using the dump main thread to open the preset dump file in the non-volatile memory; Using the dump main thread to write the file header area of ​​the preset dump file; wherein the file header area includes a header area and a tail area, the header area and the tail area are both used to store the same file header, and the file header includes the signature, type, number of memory page areas and number of virtual memory areas of the preset dump file; Using each of the preset threads to write the corresponding memory page areas in the preset dump file; wherein each of the memory page areas is used to store data of a corresponding memory page to be dumped; Using the dump main thread to write the logical page number area in the preset dump file; wherein each of the logical page number areas is used to store the logical page number and data check code of a corresponding memory page to be dumped; The virtual memory area in the preset dump file is written by using the dump main thread; wherein each of the virtual memory areas is used to store the virtual memory address information and virtual memory address check code of a corresponding memory page to be dumped; The file header area is rewritten using the dump main thread, and the preset dump file is closed.

5. The method for managing backup power of a storage system according to claim 1, characterized in that: The method of using the preset thread to write the memory page to be dumped into a preset dump file, and storing the preset dump file in a non-volatile memory includes: When writing data to the preset dump file, starting the timing of the kernel timer; If the timing time of the kernel timer reaches a time threshold, the storage system is controlled to shut down.

6. The method for managing backup power of a storage system according to claim 1, characterized in that: When the system power failure is detected, the memory page to be dumped is obtained, including: When it is detected that the service main process of the storage system exits, the memory page to be dumped is locked by using the dump main thread; After using the preset thread to write the memory page to be dumped into a preset dump file and storing the preset dump file in a non-volatile memory, the method further includes: The memory page to be dumped is unlocked by utilizing the dump main thread.

7. The method for managing backup power of a storage system according to claim 1, characterized in that: After using the preset thread to write the memory page to be dumped into a preset dump file and storing the preset dump file in a non-volatile memory, the method further includes: After detecting that the system is powered on, the preset thread is used to restore the data of the memory page to be dumped in the preset dump file to the memory of the storage system.

8. The method for managing backup power of a storage system according to any one of claims 1 to 7, characterized in that: When the system power failure is detected, before obtaining the memory page to be dumped, the method further includes: Determining a target number according to the number of CPU cores of the storage system and the bandwidth of the non-volatile memory; Creating the target number of preset threads, and binding each of the preset threads to a corresponding central processing unit core; Using the thread-specific data, a space of a preset size is reserved for each of the preset threads.

9. A backup power management device for a storage system, characterized in that: include: A power-off acquisition module, used to acquire memory pages to be dumped when a system power-off is detected; wherein the memory pages to be dumped include platform memory management memory pages and non-platform memory management memory pages; A thread allocation module, used to determine the memory pages to be dumped corresponding to each preset thread; wherein the number of the preset threads is greater than or equal to 2, and different preset threads are each bound to a different central processing unit core; The data disk module is used to use the preset thread to write the memory pages to be dumped into the preset dump file, and store the preset dump file in the non-volatile memory; wherein the preset dump file includes a file header, the data of each memory page to be dumped, the logical page number and the virtual memory address information.

10. A backup power management device for a storage system, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for managing backup power supply of a storage system according to any one of claims 1 to 8 when executing the computer program.

Citation Information

Patent Citations

  • Memory management method, device and equipment and medium

    CN109597720A

  • Multi-core interaction method and system suitable for nonvolatile memory and storage medium

    CN110750356A

  • Memory data migration method and device and storage medium

    CN111143241A

  • Memory dump file generation method, device and equipment and readable storage medium

    CN115407943A

  • Memory page management method, system, device and equipment and computer medium

    CN116644006A