Oom-kill Kernel Source Analysis

Source: Internet
Author: User

Prologue: History has become the past, but the past has been buried in the invisible sand, can not become a history

Code storage:/mm/oom_kill.c main function: void out_of_memory (int gfp_mask) The main functions are as follows: 1) call select_bad_process (void) function to return the selected deleted process Task_ struct struct 2) calls the oom_kill_process (struct task_struct *p) function to send a termination signal to the process description: select_bad_process (void) iterates through all the processes (except for process 1). The budget value of the current process is counted according to a certain algorithm, and the process descriptor with the largest budget value is returned. Where the badness function is called to count the budget values for each process. For the badness function, depending on the amount of memory consumed, the startup usage time and CPU time, whether it is the root process, especially the direct access to the hardware, so in fact, we may need to adapt to our own system. In fact, this is very unusual. Auxiliary function Description: oom_kill_process (struct task_struct *p) does not terminate the parent process, but terminates a child process in the parent process, and then exits, if the current parent process does not have child processes, attempt to terminate itself. So the process of termination may not be able to solve the problem. Of course, it is likely to be called multiple times, but it does not necessarily solve the problem.

Oom-kill Kernel Source Analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.