使用sysrq-trigger的f命令,可以手动触发OOM。
# echo f > /proc/sysrq-trigger
[46104.833134] sysrq: SysRq : Manual OOM execution
[46104.840333] kworker/1:2 invoked oom-killer: gfp_mask=0x24000c0, order=-1, oom_score_adj=0
[46104.848514] kworker/1:2 cpuset=root@XiaoQiang://tmp# mems_allowed=0
[46104.854904] CPU: 1 PID: 416 Comm: kworker/1:2 Tainted: P 4.4.198 #0
[46104.862501] Workqueue: events moom_callback
[46104.866687] Stack : 86ead100 81860000 8174d134 00000037 0000744e 86a63e38 00000000 00000037
00000001 8106b1ac 8174d134 00000001 000001a0 81a63690 817fe878 86a63cbc
81860000 81069128 81870000 81a80000 81a90000 81a90000 81751fd0 86a63cbc
81860000 81043be4 81870000 86a63cf4 00001621 0000097a 81756a08 00a63cdc
81231790 81bb9800 87c1bb00 6e657665 00007374 00000000 00000000 00000000
...
[46104.902353] Call Trace:
[46104.904809] [<810177b4>] show_stack+0x70/0x8c
[46104.909198] [<811d8788>] dump_stack+0x94/0xc8
[46104.913576] [<810af864>] dump_header.isra.5+0x54/0x174
[46104.918716] [<810afd38>] oom_kill_process+0x100/0x504
[46104.923774] [<810b047c>] out_of_memory+0x2b4/0x310
[46104.928570] [<812317d4>] moom_callback+0x44/0x6c
[46104.933197] [<8104166c>] process_one_work+0x204/0x338
[46104.938252] [<810427fc>] worker_thread+0x378/0x45c
[46104.943061] [<81047028>] kthread+0xf4/0xfc
[46104.947161] [<81005478>] ret_from_kernel_thread+0x14/0x1c
[46104.952558]
[46104.954138] Mem-Info:
[46104.956433] active_anon:3737 inactive_anon:33 isolated_anon:0
[46104.956433] active_file:4573 inactive_file:3529 isolated_file:0
[46104.956433] unevictable:431 dirty:0 writeback:0 unstable:0
[46104.956433] slab_reclaimable:730 slab_unreclaimable:3299
[46104.956433] mapped:2671 shmem:832 pagetables:117 bounce:0
[46104.956433] free:5987 free_pcp:131 free_cma:0
[46104.989110] DMA free:3216kB min:560kB low:2760kB high:2900kB active_anon:1756kB inactive_anon:20kB active_file:2520kB inactive_file:1960kB unevictable:296kB isolated(anon):0kB isolated(file):0kB present:16384kB managed:16380kB mlocked:0kB dirty:0kB writeback:0kB mapped:1712kB shmem:400kB slab_reclaimable:404kB slab_unreclaimable:1888kB kernel_stack:96kB pagetables:72kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[46105.032241] lowmem_reserve[]: 0 100 100
[46105.036136] Normal free:20748kB min:3532kB low:17352kB high:18236kB active_anon:13192kB inactive_anon:112kB active_file:15772kB inactive_file:12156kB unevictable:1428kB isolated(anon):0kB isolated(file):0kB present:114688kB managed:102716kB mlocked:0kB dirty:0kB writeback:0kB mapped:8972kB shmem:2928kB slab_reclaimable:2516kB slab_unreclaimable:11308kB kernel_stack:744kB pagetables:388kB unstable:0kB bounce:0kB free_pcp:520kB local_pcp:152kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[46105.081270] lowmem_reserve[]: 0 0 0
[46105.084831] DMA: 7*4kB (UE) 9*8kB (UE) 7*16kB (UE) 10*32kB (UME) 10*64kB (UME) 16*128kB (ME) 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 3220kB
[46105.098038] Normal: 76*4kB (UME) 83*8kB (UME) 38*16kB (UME) 31*32kB (UME) 29*64kB (UME) 6*128kB (UM) 3*256kB (ME) 1*512kB (U) 2*1024kB (UE) 0*2048kB 3*4096kB (M) = 20808kB
[46105.113730] 9366 total pagecache pages
[46105.117485] 0 pages in swap cache
[46105.120848] Swap cache stats: add 0, delete 0, find 0/0
[46105.126076] Free swap = 0kB
[46105.128951] Total swap = 0kB
[46105.131875] 32768 pages RAM
[46105.134674] 0 pages HighMem/MovableOnly
[46105.138504] 2994 pages reserved
[46105.141678] [ pid ] uid tgid total_vm rss nr_ptes nr_pmds swapents oom_score_adj name
[46105.150284] [ 751] 0 751 306 143 4 0 0 0 ubusd
[46105.158903] [ 752] 0 752 412 285 3 0 0 0 ash
[46105.167378] [ 1530] 0 1530 305 128 4 0 0 0 tbusd
[46105.176045] [ 2069] 0 2069 438 242 3 0 0 0 netifd
[46105.184799] [ 2140] 0 2140 671 434 5 0 0 0 nginx
[46105.193453] [ 2177] 0 2177 632 263 5 0 0 0 fcgi-cgi
[46105.202385] [ 2186] 0 2186 365 150 4 0 0 0 odhcpd
[46105.211126] [ 2251] 0 2251 1255 428 5 0 0 0 messagingagent
[46105.220570] [ 2296] 0 2296 413 186 4 0 0 0 crond
[46105.229228] [ 2417] 0 2417 681 418 5 0 0 0 nginx
[46105.237847] [ 2459] 0 2459 412 100 3 0 0 0 telnetd
[46105.246692] [ 3484] 0 3484 1239 601 5 0 0 0 syslog-ng
[46105.255733] [ 3519] 0 3519 412 100 3 0 0 0 iweventd.sh
[46105.264909] [ 3531] 0 3531 239 110 3 0 0 0 iwevent
[46105.273748] [ 3532] 0 3532 422 232 4 0 0 0 iwevent-call
[46105.283008] [ 3560] 0 3560 477 243 5 0 0 0 trafficd
[46105.291932] [ 5496] 0 5496 687 121 3 0 0 0 smartcontroller
[46105.301475] [ 5723] 0 5723 558 289 4 0 0 0 lua
[46105.309954] [ 5997] 0 5997 1305 1012 5 0 0 0 CuInformLoader
[46105.319401] [ 6398] 0 6398 236 94 3 0 0 0 CuInform
[46105.328282] [ 6423] 0 6423 2104 1712 6 0 0 0 CuInform-inner
[46105.337717] [ 6472] 0 6472 1355 869 5 0 0 0 statisticsservi
[46105.347241] [ 7733] 0 7733 1040 518 5 0 0 0 wolink
[46105.355995] [14026] 0 14026 412 152 3 0 0 0 udhcpc
[46105.364732] [15403] 0 15403 353 241 4 0 0 0 dnsmasq
[46105.373587] [16057] 0 16057 412 153 4 0 0 0 sh
[46105.381982] [16070] 0 16070 452 332 4 0 0 0 ntpsetclock
[46105.391168] [16116] 0 16116 412 12 3 0 0 0 lock
[46105.399753] [16125] 0 16125 412 152 3 0 0 0 ntpd
[46105.408284] Out of memory: Kill process 6423 (CuInform-inner) score 55 or sacrifice child
[46105.416534] Killed process 6423 (CuInform-inner) total-vm:8416kB, anon-rss:4504kB, file-rss:2344kB