Linux system memory dump mechanism introduced (a) - kdump

 

By design philosophy Linux system, the kernel provides a mechanism to dump only memory, users want what kind of memory dump, dump belonging to the policy question is how much memory, determined by the user.

In the real usage scenarios, mainly used in two ways: kdump and coredump

1.kdump: an address space of a process dump for users to debug analysis after the process hangs.

2.coredump: dump the entire system memory, cause analysis system in order to debug hang the system administrator.

This paper describes the kdump

kexec and kdump whole process relies on an additional dump kernel to ensure proper implementation of the entire process.

kdump involved components:

1.kdump specific kernel, load through the tool to the kexec reserved memory used for fault management.

2.kexec tool, responsible for loading the kernel crash, as well as some startup parameter.

3.makedumpfile tool, responsible for the fault of the kernel memory copy, compress, write to the specified file.

kdump implementation

kdump entire process involves two kernel boot:

1. First, the kernel starts work, including hardware initialization self-test, loading of BootLoader concurrent kernel boot kernel starts and the reserved memory configuration, and the kexec tool to crash into the reserved memory load the kernel.

2. Work the kernel boot crash kernel in the face of failure triggers panic, kexec start crash kernel executes only the kernel initialization logic, do not initialize the hardware self-test, start fast.

After the kernel is loaded 3.crash good part of the system can properly manage resources, through / proc / vmcore memory image file will be written to the hard disk failure memory dump file after compression to save.

4. After the capture is complete reboot the system to complete the recovery.

With increasing system memory, recovery time grows linearly, two system startup time relatively fixed, linearly increasing time mainly due to copy memory, memory, and file compression plate off the impact. So many kdump optimization is achieved for the following main aspects:

1.copy terms of memory: In order to reduce the number of system calls, implements mmap method vmcore can improve the efficiency of copy.

2. Memory compression: the introduction of more efficient compression algorithm to replace the original lzo of the gzip algorithm.

3. To place an order: the main consideration concurrent write io files and optimize efficiency.

How to use kdump:

1. Modify the startup parameters, increasing the crash kernel field, by / proc / cmdline is in effect can be observed.

2. The mounting assembly kdump package, and comprising a crash kernel kexec assembly.

3. Start kdump service, start the service by command or the / etc directory of the startup script.

4. Observe the / proc / iomem the successful load of the crash kernel

 

Original: Linux system memory dump mechanism introduced (a) - kdump

Guess you like

Origin www.cnblogs.com/qinsoo/p/11420599.html