oom-killer

内存不够时系统会启动oom-killer
~ # xxx_test 192.168.1.29 192.168.1.71
rtl8168: eth0: link up
info [create_socket_srv:354]: listening on port : 6789
info [listen_func:304]: connection[4] : 192.168.1.71:43786
[process_cmd:365]: $taes #cd
ft2_test invoked oom-killer: gfp_mask=0x200da, order=0, oom_score_adj=0
CPU: 0 PID: 107 Comm: ft2_test Not tainted 3.10.27+ #401
Stack : 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 8efc9b98

Call Trace:[<800144f4>] 0x800144f4
[<800144f4>] 0x800144f4
[<80446c20>] 0x80446c20
[<80189f04>] 0x80189f04
[<80066744>] 0x80066744
[<80028420>] 0x80028420
[<800665e8>] 0x800665e8
[<80066568>] 0x80066568
[<80066ff0>] 0x80066ff0
[<8006a648>] 0x8006a648
[<8018ed24>] 0x8018ed24
[<8007ba94>] 0x8007ba94
[<8007e370>] 0x8007e370
[<8007e040>] 0x8007e040
[<800804a8>] 0x800804a8
[<8007bc88>] 0x8007bc88
[<80017428>] 0x80017428
[<800809c4>] 0x800809c4
[<8018add4>] 0x8018add4
[<80073cdc>] 0x80073cdc
[<8007f76c>] 0x8007f76c
[<8018add4>] 0x8018add4
[<8007eeac>] 0x8007eeac
[<80011ba4>] 0x80011ba4
[<8018eb98>] 0x8018eb98

Mem-Info:
Normal per-cpu:
CPU 0: hi: 90, btch: 15 usd: 33
active_anon:42496 inactive_anon:0 isolated_anon:0
active_file:0 inactive_file:2 isolated_file:0
unevictable:958 dirty:0 writeback:0 unstable:0
free:427 slab_reclaimable:163 slab_unreclaimable:343
mapped:156 shmem:0 pagetables:54 bounce:0
free_cma:0
Normal free:1708kB min:1728kB low:2160kB high:2592kB active_anon:169984kB inactive_anon:0kB active_file:0kB inactive_file:8kB unevictable:3832kB isolated(anon):0kB isolated(file):0kB present:262144kB managed:187256kB mlocked:0kB dirty:0kB writeback:0kB mapped:624kB shmem:0kB slab_reclaimable:652kB slab_unreclaimable:1372kB kernel_stack:272kB pagetables:216kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:46 all_unreclaimable? yes
lowmem_reserve[]: 0 0
Normal: 1*4kB (M) 1*8kB (U) 2*16kB (UM) 0*32kB 2*64kB (UM) 0*128kB 0*256kB 1*512kB (M) 1*1024kB (M) 0*2048kB 0*4096kB = 1708kB
960 total pagecache pages
65536 pages RAM
18347 pages reserved
270083 pages shared
44021 pages non-shared
[ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name
[ 84] 0 84 214 96 3 0 0 sh
[ 96] 0 96 46273 42577 48 0 0 ft2_test
Out of memory: Kill process 96 (ft2_test) score 873 or sacrifice child
Killed process 96 (ft2_test) total-vm:185092kB, anon-rss:169872kB, file-rss:436kB
Killed

oom-killer
oom-killer相关的内核代码位置在mm/oom-kill.c
oom-killer会在内存紧张的时候,依次kill内存占用较高的进程,发送signal 15(SIGTERM),并在/var/log/message中进行记录。

Oom-kill杀死进程的机制
/proc/vm/oom_adj 表示该pid进程被oom killer杀掉的权重,在[-17, 15]之间,越高的权重,意味着越有可能被oom-killer选中,-17表示禁止被kill掉。
/proc/vm/oom_score 当前进程被kill的分数,越高的分数,意味着越有可能被kill

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

luckywang1103

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值