Linux OOM killer

I, EDITORIAL

  Parameters --oom-score-adj learning docker recently encountered in the process, so I understand simple access to information under the OOM and recorded, did not read books related to the kernel (a chicken dish -_- | |), you pass by the fellow can have a good book recommendation, very grateful, mua ~~

Second, what is the OOM

  OOM abbreviation is out of memory when "failure" of the program running on your system, it will eat all your memory resources, resulting kernel can not allocate memory in other processes (OOM). Although the system administrator can add memory to temporarily solve the problem, but would like to solve the problem or to dispose of this program from the root. But before administrator intervention, the face of OOM kernel also has its own approach, it is subject to the appropriate treatment according to the parameters of the OOM.

Three, OOM-related parameters

1. /proc/sys/vm/panic_on_oom

  • Arguments

    • A value of 0: Start OOM killer.

      • When the value is 0 or not step on panic_on_oom trigger kernel panic, kernel will check / proc / sys / vm / oom_kill_allocating_task.
    • A value of 1: indicates it is likely to trigger kernel panic, it is also possible to start OOM killer.
    • A value of 2: indicates a mandatory trigger kernel panic, a kernel panic GG.

2. /proc/sys/vm/oom_kill_allocating_task

  • Arguments

    • A value of 0: process will kill off the highest score (how scoring look down)
    • It is nonzero: will kill off the current application process memory triggered OOM
    • Of course, some system processes (such as init) or set of users, and the process of oom_score_adj not that just kill kill.

3. /proc/sys/vm/oom_dump_tasks

  • Introduction

    • As a system administrator, we certainly hope that either appear or kernel panic situation OOM killer are able to leave some things similar logs, let us understand the reasons for such a situation occur, oom_dump_tasks process parameters can be recorded identification information, the process uses the total amount of virtual memory, physical memory, page table information processes, and so on.
  • Arguments

    • A value of 0: Close above print log. In a large system, there may be thousands of process, one by one print memory usage information may cause performance problems.
    • It is nonzero: There are three situations the printing process memory usage

      • When the OOM cause kernel panic
      • When the qualifying process kill not found
      • Find qualified process and kill time

4. oom_adj、oom_score_adj 和 oom_score

  • Introduction

    • The reason put together, because the correlation of these three parameters more closely. These three parameters are specific and process-related, so the location is under / proc / process PID / directory. Suppose now that has been selected is the time to start appear OOM killer, then what process kill it? It depends on their scores, the higher the score, the faster G. (Slag suddenly feel that learning is still pretty happy ^ _ ^)
    • Kernel will process scoring (oom_score), it consists of two parts, user ratings and scoring system. Scoring system is based on the physical memory consumption process; oom_score_adj is the value of a user score. If the user specifies oom_score_adj value -1000 is expressed prohibit OOM killer to kill the process.
    • The user may be determined by the final value of the adjustment value oom_score_adj of oom_score, oom_score_adj the range is -1000 to 1000, indicating that the user is not adjusted oom_score 0. In addition, root process owns 3% of memory usage privilege, and therefore need to subtract the amount of memory to use when making the final oom_score calculations.
    • oom_adj is an old interface parameter, whose function is similar to oom_score_adj, for compatibility, still retained this parameter when operating this parameter, kernel actually be converted into oom_score_adj.


Fourth, references



Writing is not easy, please indicate the source, thank you ~~

Guess you like

Origin www.cnblogs.com/ccbloom/p/11249871.html