[go: up one dir, main page]

CN110309008B - Method and system for storing memory data in case of system abnormality - Google Patents

Method and system for storing memory data in case of system abnormality Download PDF

Info

Publication number
CN110309008B
CN110309008B CN201810232379.7A CN201810232379A CN110309008B CN 110309008 B CN110309008 B CN 110309008B CN 201810232379 A CN201810232379 A CN 201810232379A CN 110309008 B CN110309008 B CN 110309008B
Authority
CN
China
Prior art keywords
data
original system
space
user
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810232379.7A
Other languages
Chinese (zh)
Other versions
CN110309008A (en
Inventor
邢影
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201810232379.7A priority Critical patent/CN110309008B/en
Publication of CN110309008A publication Critical patent/CN110309008A/en
Application granted granted Critical
Publication of CN110309008B publication Critical patent/CN110309008B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/073Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a memory management context, e.g. virtual memory or cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/142Reconfiguring to eliminate the error
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention provides a method and a system for storing memory data in case of system abnormality, wherein the method comprises the steps of reserving an address space in a memory by configuration, and storing log buffer data and user application buffer data of an original system into the address space; switching the original system to a kdump system, mounting partitions of the original system by the kdump system, and respectively storing data in an address space to matched partitions in the original system; partitioning an original system, reserving a physical space, and reserving a cache space in a memory by configuration; writing first user data with valid flag bits in a physical space into a disk array; writing the second user data generated in real time into the cache space, and then writing the second user data into the disk array according to an optimization strategy; and switching the original system to a kdump system, storing the second user data into a physical space, and setting the flag bit of the second user data as effective. The invention can solve the problem of partial data loss in the memory when the system crashes, crashes or deadlocks occur.

Description

Method and system for storing memory data in case of system abnormality
Technical Field
The invention relates to the technical field of data storage, in particular to a method and a system for storing memory data during system abnormality.
Background
With the maturation of network technology, development of internet and cloud computing technology, computers are widely used. When the computer runs, due to errors such as program or calculation, the conditions such as system breakdown, downtime, deadlock and the like can occur, if the computer is restarted or shut down, the memory data can be lost, the problem positioning and solving are not facilitated, and huge loss caused by data loss exists. Linux provides kdump functions, and when a system crash, downtime or deadlock occurs, the Linux can switch to a kdump kernel to save the running state of the memory for an engineer to analyze.
In the prior art, the kdump module in the Linux source code is adopted, when Linux is started, a kdump kernel is operated in a memory, when the current Linux system is crashed, down or deadlock occurs, the current Linux system is immediately switched to the kdump kernel, the memory operation state is collected, and the memory operation state is stored as a vmcore file. This solution has mainly the following drawbacks: when the first system crashes, is down or is in deadlock, the Linux system log is still recorded in the log buffer area and is not stored in the messages file of the Linux system, and once the Linux system is restarted or is shut down, the content in the buffer can be lost. Second, kdump collects general information, and data information generated by user applications, if left in memory, is lost once restarted or powered off. Thirdly, when the user application writes data to the disk array, in order to increase the writing speed, a write cache is used, and once a system crash, downtime or deadlock occurs, the user data in the write cache is lost due to restarting or shutdown.
Disclosure of Invention
Therefore, the present invention aims to provide a method and a system for saving memory data in the event of system exception, so as to solve the problem of partial data loss in the memory when system crash, downtime or deadlock occurs.
In a first aspect, an embodiment of the present invention provides a method for storing memory data during system exception, where the method includes:
an original system is configured, an address space is reserved in a memory, and log cache area data and user application cache area data cached in the original system are stored in the address space;
switching the original system to a kdump system, wherein the kdump system mounts a partition of the original system, and respectively storing the log cache data and the user application cache data into the matched partition in the original system based on the address space;
partitioning the original system, reserving a physical space, and reserving a cache space in a memory by configuring the original system;
writing first user data with valid zone bits in the physical space into a disk array;
writing the second user data generated in real time into the cache space, and then writing the second user data into the disk array according to an optimization strategy;
and switching the original system to the kdump system, storing the second user data into the physical space, and setting the flag bit of the second user data to be valid.
With reference to the first aspect, an embodiment of the present invention provides a first possible implementation manner of the first aspect, where the configuring an original system, reserving an address space in a memory, and storing log cache data and user application cache data cached in the original system into the address space includes:
the address space is reserved in the memory by configuring a startup manager file grub.conf of the original system;
acquiring a structure body of a log cache area and a structure body of a user application data cache area of the original system;
calling a panic function panic during running under the condition of system abnormality, and storing the data of the log cache area into the address space through a structural body of the log cache area;
and storing the user application buffer data to the address space through the structure body of the user application data buffer.
With reference to the first aspect, an embodiment of the present invention provides a second possible implementation manner of the first aspect, where the switching the original system to a kdump system, where the kdump system mounts a partition of the original system, and based on the address space, stores the log cache data and the user application cache data into the matched partition in the original system, where the storing includes:
mapping the address space to obtain a memory virtual address of the original system with access authority;
switching the original system to the kdump system, wherein the kdump system mounts the partition of the original system;
and reading the log cache data and the user application cache data through the memory virtual address and respectively storing the log cache data and the user application cache data into the matched partition.
With reference to the first aspect, an embodiment of the present invention provides a third possible implementation manner of the first aspect, where partitioning the original system, reserving a physical space, and reserving a cache space in a memory by configuring the original system includes:
partitioning the original system, and reserving the matched physical space according to the cache size;
and configuring a startup manager file grub.conf of the original system, and reserving the cache space in a memory.
With reference to the first aspect, an embodiment of the present invention provides a fourth possible implementation manner of the first aspect, where writing, to a disk array, first user data with valid flag bits in the physical space includes:
acquiring a zone bit of the data recorded in the physical space through user application;
judging whether the flag bit is valid or not;
if the first user data is valid, checking through the user application and writing the corresponding first user data into the disk array;
if not, no processing is performed.
With reference to the first aspect, an embodiment of the present invention provides a fifth possible implementation manner of the first aspect, where the switching the original system to the kdump system, saving the second user data into the physical space, and setting a flag bit of the second user data to be valid includes:
calling a panic function panic in running under the condition of system abnormality, and switching the original system to the kdump system;
and writing the second user data in the buffer space into the physical space based on the kdump system, and setting a flag bit of the second user data to be valid.
In a second aspect, an embodiment of the present invention further provides a system for saving memory data during system exception, where the system includes:
the first reserved space unit is used for reserving an address space in a memory by configuring an original system and storing log cache area data and user application cache area data cached in the original system into the address space;
the first data storage unit is used for switching the original system to a kdump system, wherein the kdump system mounts a partition of the original system, and based on the address space, the log cache data and the user application cache data are respectively stored into the matched partition in the original system;
the second reserved space unit is used for partitioning the original system, reserving a physical space, and reserving a cache space in a memory by configuring the original system;
the first writing unit is used for writing first user data with valid flag bits in the physical space into the disk array;
the second writing unit is used for writing the second user data generated in real time into the cache space and then writing the second user data into the disk array according to an optimization strategy;
and the second data storage unit is used for switching the original system to the kdump system, storing the second user data into the physical space and setting the flag bit of the second user data to be valid.
With reference to the second aspect, an embodiment of the present invention provides a first possible implementation manner of the second aspect, where the first headspace unit includes:
the address space is reserved in a memory by configuring grub.conf of the original system;
acquiring a structure body of a log cache area and a structure body of a user application data cache area of the original system;
calling a panic under the condition of system abnormality, and storing the data of the log cache area into the address space through a structural body of the log cache area;
and storing the user application buffer data to the address space through the structure body of the user application data buffer.
With reference to the second aspect, an embodiment of the present invention provides a second possible implementation manner of the second aspect, where the first data storage unit includes:
mapping the address space to obtain a memory virtual address of the original system with access authority;
switching the original system to the kdump system, wherein the kdump system mounts the partition of the original system;
and reading the log cache data and the user application cache data through the memory virtual address and respectively storing the log cache data and the user application cache data into the matched partition.
The embodiment of the invention has the following beneficial effects: the invention provides a method and a system for storing memory data in case of system abnormality, wherein the method comprises the following steps: the method comprises the steps of configuring an original system, reserving an address space in a memory, and storing log cache data and user application cache data cached in the original system into the address space; switching the original system to a kdump system, mounting a partition of the original system by the kdump system, and respectively storing log cache data and user application cache data into matched partitions in the original system based on an address space; partitioning an original system, reserving a physical space, and reserving a cache space in a memory by configuring the original system; writing first user data with valid flag bits in a physical space into a disk array; writing the second user data generated in real time into the cache space, and then writing the second user data into the disk array according to an optimization strategy; and switching the original system to a kdump system, storing the second user data into a physical space, and setting the flag bit of the second user data to be valid. The invention can solve the problem of partial data loss in the memory when the system crashes, crashes or deadlocks occur.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the above objects, features and advantages of the present invention more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for storing memory data during system exception according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for storing message information data during system exception according to a second embodiment of the present invention;
FIG. 3 is a flowchart of a method for storing user data in case of system abnormality according to a third embodiment of the present invention;
fig. 4 is a schematic diagram of a system for saving memory data during system exception according to a fourth embodiment of the present invention.
Icon:
100-a first headspace unit; 200-a first data saving unit; 300-a second headspace unit; 400-a first writing unit; 500-a second writing unit; 600-a second data holding unit.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Currently, linux provides kdump functions, and when a system crash, downtime or deadlock occurs, the Linux can switch to a kdump kernel to save the running state of the memory for an engineer to analyze. However, this solution has mainly the following drawbacks: when the first system crashes, is down or is in deadlock, the Linux system log is still recorded in the log buffer area and is not stored in the messages file of the Linux system, and once the Linux system is restarted or is shut down, the content in the buffer can be lost. Second, kdump collects general information, and data information generated by user applications, if left in memory, is lost once restarted or powered off. Thirdly, when the user application writes data to the disk array, in order to increase the writing speed, a write cache is used, and once a system crash, downtime or deadlock occurs, the user data in the write cache is lost due to restarting or shutdown.
Based on the method and the system for storing the memory data in the abnormal system, which are provided by the embodiment of the invention, the problem that partial data in the memory is lost when the system crashes, crashes or deadlocks occur can be solved.
For the sake of understanding the present embodiment, first, a method for storing memory data during system abnormality disclosed in the present embodiment will be described in detail.
Embodiment one:
fig. 1 is a flowchart of a method for saving memory data during system exception according to an embodiment of the present invention.
The scheme provided by the embodiment is as follows: when system abnormality (including system crash, system downtime or system deadlock) occurs, important data or information remained in the memory by the system or user application is collected and stored, so that the data cannot be lost due to restarting or shutdown of the system. The data here fall into two categories: the messages information data (system log messages or user data) that needs to be written to the Linux file system, and the user data that needs to be written to the disk array.
As shown in fig. 1, a method for storing memory data during system exception is described, wherein steps S110 to S120 are implemented to protect the messages information data to be written into the Linux file system, and steps S130 to S160 are implemented to protect the user data to be written into the disk array. The method for storing the memory data when the system is abnormal comprises the following steps:
step S110, an original system (namely a Linux system) is configured, an address space M is reserved in a memory, and log cache data and user application cache data cached in the original system are stored in the address space M;
step S120, switching the original system to a kdump system, mounting a partition of the original system by the kdump system, and respectively storing the data of the log cache area and the data of the user application cache area into the matched partition in the original system based on the address space M;
step S130, partitioning the original system, reserving a physical space Z, and reserving a cache space N in a memory by configuring the original system;
step S140, writing the first user data with the valid flag bit in the physical space Z into a disk array;
step S150, writing the second user data generated in real time into the cache space N, and then writing the second user data into the disk array according to an optimization strategy;
step S160, switching the original system to a kdump system, storing the second user data into the physical space Z, and setting the flag bit of the second user data to be valid. In addition, after the original system is restarted, the steps S140 to S160 are repeatedly executed, that is, the data flag bit in the physical space Z is repeatedly read, and the valid data of the flag bit is written into the disk array, so that the data written into the cache can be ensured not to be lost.
Therefore, according to the scheme provided by the embodiment, when the Linux system is in system crash, downtime or deadlock, the memory data is protected through the following two aspects:
on the one hand, the address space M is reserved in the memory, and in the process of switching kdump when a system breakdown occurs, the following processing is added: the data of the messages cache area of the Linux system or the data of the residual cache area of the user application are firstly stored in a reserved address space M, after the switching to the kdump system, the original system partition is mounted, and then the data in the address space M are written into the matched messages of the original system or the user application of the original system.
On the other hand, a physical space Z is reserved in the original system partition, and a cache space N is reserved in the memory; to improve performance, user data is written into the buffer space N first, and then written into the disk array with an optimization strategy. When a system crash occurs, switching to a kdump system, writing data of the cache space N into the physical space Z, and setting a data flag bit to be effective. After the original system is restarted, the data zone bit recorded on the physical space Z is read, and if the data zone bit is valid, the data of the physical space Z is written into the disk array.
Embodiment two:
fig. 2 is a flowchart of a method for storing message information data during system exception according to a second embodiment of the present invention.
Referring to fig. 2, when a system abnormality occurs, an implementation scheme for protecting message information data to be written into a Linux file system includes steps of expanding description of step S110 in a method for storing memory data when the system abnormality occurs, and steps S240 to S260 are expanding description of step S120.
In step S210, an address space M is reserved in the memory by configuring grub. Specifically, a grub.conf file is configured in the original system, and a block of address space M is reserved from the memory by configuring a memmap parameter. Then, the kdump function of the original system is enabled.
Step S220, the structure of the log buffer area and the structure of the user application data buffer area of the original system are obtained. Specifically, the address pointer, the total length, the structure of the start index and the end index of the original system log buffer area and the structure of the address pointer and the size of the user application data buffer area are obtained from the kernel.
Step S230, calling a panic function when a system abnormality occurs, and storing the data of the log buffer into an address space through a structure of the log buffer; and storing the user application buffer data to an address space through the structure of the user application data buffer.
Step S240, mapping the address space to obtain the memory virtual address with access right of the original system. Specifically, the starting address of the reserved address space M is mapped into a memory virtual address accessible by the Linux system in an ioremap_nocacache mode.
And S250, switching the original system to a kdump system, and mounting the partition of the original system by the kdump system. Specifically, log buffer data and user application buffer data are stored to an address space, and then a Linux mechanism is used for switching a kdump system; after switching to the kdump system, the partition of the original system is mounted in a mount mode.
In step S260, the log buffer data and the user application buffer data are read through the memory virtual address and respectively stored into the matched partition, such as the messages file or the user application data of the original system partition.
Embodiment III:
fig. 3 is a flowchart of a method for storing user data during system abnormality according to a third embodiment of the present invention.
Referring to fig. 3, the implementation scheme for protecting user data to be written to a disk array when a system abnormality occurs includes steps of expanding description of step S130 in a method for storing memory data when a system abnormality occurs, steps S330 to S350 are expanding description of step S140, and steps S370 to S380 are expanding description of step S160.
Step S310, partitioning the original system, and reserving matched physical space according to the cache size;
step S320, reserving a cache space in a memory by configuring grub.conf of the original system; namely: and configuring a grub.conf file of the original system, and reserving a block of space N from a memory as a data writing cache by configuring a memmap parameter. Then, the kdump function of the original system is enabled.
Step S330, obtaining the zone bit of the data recorded in the physical space Z through user application;
step S340, judging whether the flag bit is valid; if so, step S350 is performed; if not, no processing is performed and step S360 is entered;
step S350, checking through user application and writing corresponding first user data into a disk array;
step S360, writing the second user data generated in real time into the buffer space, and then writing the second user data into the disk array according to an optimization strategy;
step S370, calling a panic and switching the original system to a kdump system under the condition of system abnormality;
in step S380, based on the kdump system, the second user data in the buffer space N is written into the physical space Z, and the flag bit of the second user data is set to be valid.
In addition, after the original system is restarted, the steps S320 to S380 are repeated, so that the written cache data can be ensured not to be lost.
Embodiment four:
fig. 4 is a schematic diagram of a system for saving memory data during system exception according to a fourth embodiment of the present invention.
The embodiment of the invention also provides a system for storing the memory data in the system abnormality, which is used for realizing the method for storing the memory data in the system abnormality provided by the embodiment. Referring to fig. 4, the system for saving memory data in the case of system abnormality includes the following units:
the first reserved space unit 100 is configured to reserve an address space in a memory by configuring an original system, and store log buffer data and user application buffer data cached in the original system into the address space;
the first data storage unit 200 is configured to switch the original system to a kdump system, mount a partition of the original system on the kdump system, and store log buffer data and user application buffer data into matched partitions in the original system based on an address space;
the second reserved space unit 300 is configured to partition the original system, reserve a physical space, and reserve a cache space in the memory by configuring the original system;
a first writing unit 400, configured to write first user data with valid flag bits in the physical space Z into the disk array;
the second writing unit 500 is configured to write the second user data generated in real time into the buffer space, and then write the second user data into the disk array according to an optimization policy;
and a second data storage unit 600, configured to switch the original system to the kdump system, store the second user data into the physical space, and set the flag bit of the second user data to be valid.
Further, the first headspace unit 100 includes:
by configuring grub.conf of the original system, reserving an address space in a memory;
acquiring a structure body of a log cache area and a structure body of a user application data cache area of an original system;
calling a panic under the condition of system abnormality, and storing the data of the log cache area into an address space through a structure body of the log cache area;
and storing the user application buffer data to an address space through the structure of the user application data buffer.
Further, the first data saving unit 200 includes:
mapping the address space to obtain a memory virtual address with access authority of the original system;
switching the original system to a kdump system, and mounting a partition of the original system by the kdump system;
and reading the log buffer data and the user application buffer data through the memory virtual address and respectively storing the log buffer data and the user application buffer data into the matched partition.
The embodiment of the invention has the following beneficial effects: the invention provides a method and a system for storing memory data in case of system abnormality, wherein the method comprises the following steps: the method comprises the steps of configuring an original system, reserving an address space in a memory, and storing log cache data and user application cache data cached in the original system into the address space; switching the original system to a kdump system, mounting a partition of the original system by the kdump system, and respectively storing log cache data and user application cache data into matched partitions in the original system based on an address space; partitioning an original system, reserving a physical space, and reserving a cache space in a memory by configuring the original system; writing first user data with valid flag bits in a physical space into a disk array; writing the second user data generated in real time into the cache space, and then writing the second user data into the disk array according to an optimization strategy; and switching the original system to a kdump system, storing the second user data into a physical space, and setting the flag bit of the second user data to be valid. The invention can solve the problem of partial data loss in the memory when the system crashes, crashes or deadlocks occur.
The system provided by the embodiment of the present invention has the same implementation principle and technical effects as those of the foregoing method embodiment, and for the sake of brevity, reference may be made to the corresponding content in the foregoing method embodiment where the system embodiment is not mentioned.
The embodiment of the invention also provides an electronic device, which comprises a memory and a processor, wherein the memory stores a computer program which can run on the processor, and the processor realizes the steps of the method for storing the memory data in the case of system abnormality when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program is executed by a processor to execute the steps of the method for storing the memory data when the system is abnormal in the embodiment.
In the description of the present invention, it should be noted that the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the above examples are only specific embodiments of the present invention, and are not intended to limit the scope of the present invention, but it should be understood by those skilled in the art that the present invention is not limited thereto, and that the present invention is described in detail with reference to the foregoing examples: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (9)

1. The method for storing the memory data in the system abnormality is characterized by comprising the following steps:
an original system is configured, an address space is reserved in a memory, and log cache area data and user application cache area data cached in the original system are stored in the address space;
switching the original system to a kdump system, wherein the kdump system mounts a partition of the original system, and respectively storing the log cache data and the user application cache data into the matched partition in the original system based on the address space;
partitioning the original system, reserving a physical space, and reserving a cache space in a memory by configuring the original system;
writing first user data with valid zone bits in the physical space into a disk array;
writing the second user data generated in real time into the cache space, and then writing the second user data into the disk array according to an optimization strategy;
switching the original system to the kdump system, storing the second user data into the physical space, and setting the flag bit of the second user data to be valid;
and after the original system is restarted, repeatedly reading the zone bits of the first user and the second user, and writing the valid data of the zone bits into a disk array.
2. The method according to claim 1, wherein the configuring the original system, reserving an address space in a memory, and saving the log buffer data and the user application buffer data cached in the original system to the address space, includes:
the address space is reserved in the memory by configuring a startup manager file grub.conf of the original system;
acquiring a structure body of a log cache area and a structure body of a user application data cache area of the original system;
calling a panic function panic during running under the condition of system abnormality, and storing the data of the log cache area into the address space through a structural body of the log cache area;
and storing the user application buffer data to the address space through the structure body of the user application data buffer.
3. The method of claim 1, wherein the switching the original system to a kdump system, the kdump system mounting a partition of the original system, storing the log cache data and the user application cache data into the matched partition in the original system based on the address space, respectively, comprises:
mapping the address space to obtain a memory virtual address of the original system with access authority;
switching the original system to the kdump system, wherein the kdump system mounts the partition of the original system;
and reading the log cache data and the user application cache data through the memory virtual address and respectively storing the log cache data and the user application cache data into the matched partition.
4. The method of claim 1, wherein partitioning the original system, reserving physical space, and reserving cache space in a memory by configuring the original system, comprises:
partitioning the original system, and reserving the matched physical space according to the cache size;
and configuring a startup manager file grub.conf of the original system, and reserving the cache space in a memory.
5. The method of claim 1, wherein writing the first user data with the valid flag bit in the physical space to the disk array comprises:
acquiring a zone bit of the data recorded in the physical space through user application;
judging whether the flag bit is valid or not;
if the first user data is valid, checking through the user application and writing the corresponding first user data into the disk array;
if not, no processing is performed.
6. The method of claim 1, wherein the switching the original system to the kdump system, saving the second user data into the physical space, and setting a flag bit of the second user data to be valid, comprises:
calling a panic function panic in running under the condition of system abnormality, and switching the original system to the kdump system;
and writing the second user data in the buffer space into the physical space based on the kdump system, and setting a flag bit of the second user data to be valid.
7. A system for storing memory data in the event of a system abnormality, comprising:
the first reserved space unit is used for reserving an address space in a memory by configuring an original system and storing log cache area data and user application cache area data cached in the original system into the address space;
the first data storage unit is used for switching the original system to a kdump system, wherein the kdump system mounts a partition of the original system, and based on the address space, the log cache data and the user application cache data are respectively stored into the matched partition in the original system;
the second reserved space unit is used for partitioning the original system, reserving a physical space, and reserving a cache space in a memory by configuring the original system;
the first writing unit is used for writing first user data with valid flag bits in the physical space into the disk array;
the second writing unit is used for writing the second user data generated in real time into the cache space and then writing the second user data into the disk array according to an optimization strategy;
the second data storage unit is used for switching the original system to the kdump system, storing the second user data into the physical space and setting the flag bit of the second user data to be valid; and after the original system is restarted, repeatedly reading the zone bits of the first user and the second user, and writing the valid data of the zone bits into a disk array.
8. The system of claim 7, wherein the first headspace unit comprises:
the address space is reserved in a memory by configuring grub.conf of the original system;
acquiring a structure body of a log cache area and a structure body of a user application data cache area of the original system;
calling a panic under the condition of system abnormality, and storing the data of the log cache area into the address space through a structural body of the log cache area;
and storing the user application buffer data to the address space through the structure body of the user application data buffer.
9. The system of claim 7, wherein the first data-holding unit comprises:
mapping the address space to obtain a memory virtual address of the original system with access authority;
switching the original system to the kdump system, wherein the kdump system mounts the partition of the original system;
and reading the log cache data and the user application cache data through the memory virtual address and respectively storing the log cache data and the user application cache data into the matched partition.
CN201810232379.7A 2018-03-20 2018-03-20 Method and system for storing memory data in case of system abnormality Active CN110309008B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810232379.7A CN110309008B (en) 2018-03-20 2018-03-20 Method and system for storing memory data in case of system abnormality

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810232379.7A CN110309008B (en) 2018-03-20 2018-03-20 Method and system for storing memory data in case of system abnormality

Publications (2)

Publication Number Publication Date
CN110309008A CN110309008A (en) 2019-10-08
CN110309008B true CN110309008B (en) 2023-06-20

Family

ID=68073851

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810232379.7A Active CN110309008B (en) 2018-03-20 2018-03-20 Method and system for storing memory data in case of system abnormality

Country Status (1)

Country Link
CN (1) CN110309008B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105242981A (en) * 2015-10-30 2016-01-13 浪潮电子信息产业股份有限公司 Configuration method of Kdump and computer device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7509521B2 (en) * 2004-08-23 2009-03-24 Microsoft Corporation Memory dump generation with quick reboot
US10949415B2 (en) * 2011-03-31 2021-03-16 International Business Machines Corporation Logging system using persistent memory
EP2842035A2 (en) * 2012-04-27 2015-03-04 Marvell World Trade Ltd. Memory dump and analysis in a computer system
US9026860B2 (en) * 2012-07-31 2015-05-05 International Business Machines Corpoation Securing crash dump files
CN103809989B (en) * 2012-11-08 2017-07-11 英华达(南京)科技有限公司 The method that operating system occurs reading complete kernel daily record under core collapse case
CN105204977A (en) * 2014-06-30 2015-12-30 中兴通讯股份有限公司 System exception capturing method, main system, shadow system and intelligent equipment
CN106571954B (en) * 2016-10-24 2020-01-07 上海斐讯数据通信技术有限公司 Method and device for detecting abnormal restart reason of AP (access point) equipment

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105242981A (en) * 2015-10-30 2016-01-13 浪潮电子信息产业股份有限公司 Configuration method of Kdump and computer device

Also Published As

Publication number Publication date
CN110309008A (en) 2019-10-08

Similar Documents

Publication Publication Date Title
US9177028B2 (en) Deduplicating storage with enhanced frequent-block detection
US7424577B2 (en) Dynamic optimization of cache memory
CN105677580A (en) Method and device for accessing cache
CN108363620B (en) Memory module for providing virtual memory capacity and operation method thereof
US7430639B1 (en) Optimization of cascaded virtual cache memory
US10049036B2 (en) Reliable distributed messaging using non-volatile system memory
CN111679914B (en) Memory management method, system, computer equipment and storage medium
US9767015B1 (en) Enhanced operating system integrity using non-volatile system memory
US9760480B1 (en) Enhanced logging using non-volatile system memory
US9940023B2 (en) System and method for an accelerator cache and physical storage tier
EP3276494B1 (en) Memory space management
CN106164874B (en) Method and device for accessing data visitor directory in multi-core system
US10089220B1 (en) Saving state information resulting from non-idempotent operations in non-volatile system memory
CN110309008B (en) Method and system for storing memory data in case of system abnormality
CN110119641B (en) Disk protection method and system based on Linux and computer readable storage medium
JP2012078940A (en) Computer and computing system
CN118312102A (en) IO request processing method and device, storage equipment and storage medium
CN111858393A (en) Memory page management method, memory page management device, medium and electronic device
CN112463652B (en) Data processing method, device, processing chip and server based on cache coherence
CN116243871A (en) Data storage system, data storage method and electronic device
CN103631640B (en) A kind of data access request response method and device
US20060294334A1 (en) Statement regarding federally sponsored-research or development
TWI569129B (en) System suspend method, system resume method and computer system using the same
US12236091B2 (en) Monitoring memory locations to identify whether data stored at the memory locations has been modified
CN115016740A (en) Data recovery method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant