启动我们的程序长时间拉流一段时间,系统内存不足导致触发linux的OOM killer保护机制,kill掉内存占用较高的HPC03C进程 ,打印如下:
[16321.605050] HPC03C invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
[16321.645746] CPU: 0 PID: 119 Comm: HPC03C Tainted: G O 3.10.14 #2
[16321.667660] Stack : 00000006 8003b6c0 00000000 804b0000 00000000 00000000 00000000 00000000
00000000 00000000 80522e2a 0000003e 81e90f58 000013b9 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 816a3b00 816a3b64 80451674
804aa1c7 8003cb24 00000000 80451674 00000000 00000077 81e90f58 816a3ad8
...
[16321.858096] Call Trace:
[16321.868528] [<80020ca4>] show_stack+0x48/0x70
[16321.885701] [<803abb9c>] dump_stack+0x20/0x2c
[16321.907941] [<803aa580>] dump_header.isra.14+0x8c/0x1c4
[16321.919646] [<8009db74>] oom_kill_process+0xc4/0x44c
[16321.945295] [<8009e3ec>] out_of_memory+0x2c0/0x318
[16321.966288] [<800a1cf8>] __alloc_pages_nodemask+0x638/0x830
[16321.984326] [<8009cbd0>] filemap_fault+0x330/0x498
[16322.006701] [<800b8d40>] __do_fault+0xd0/0x4b0
[16322.028251] [<800bc6d4>] handle_pte_fault+0x334/0x84c
[16322.053548] [<800bcc8c>] handle_mm_fault+0xa0/0xe0
[16322.079625] [<80025958>] do_page_fault+0x148/0x420
[16322.084753] [<8001bec4>] resume_userspace_check+0x0/0x10
[16322.110213]
[16322.119040] Mem-Info:
[16322.121490] Normal per-cpu:
[16322.130454] CPU 0: hi: 0, btch: 1 usd: 0
[16322.145833] active_anon:5107 inactive_anon:3 isolated_anon:0
[16322.145833] active_file:172 inactive_file:159 isolated_file:0
[16322.145833] unevictable:0 dirty:0 writeback:0 unstable:0
[16322.145833] free:281 slab_reclaimable:171 slab_unreclaimable:750
[16322.145833] mapped:217 shmem:5 pagetables:73 bounce:0
[16322.145833] free_cma:0
[16322.258017] Normal free:904kB min:720kB low:900kB high:1080kB active_anon:20428kB inactive_anon:12kB active_file:680kB inactive_file:860kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:38912kB managed:32728kB mlocked:0kB dirty:0kB writeback:0kB mapped:848kB shmem:20kB slab_reclaimable:684kB slab_unreclaimable:3000kB kernel_stack:592kB pagetables:292kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[16322.390479] lowmem_reserve[]: 0 0
[16322.407231] Normal: 45*4kB (UM) 6*8kB (U) 46*16kB (UM) 1*32kB (M) 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB 0*65536kB = 996kB
[16322.468905] 354 total pagecache pages
[16322.489525] 0 pages in swap cache
[16322.499744] Swap cache stats: add 0, delete 0, find 0/0
[16322.522507] Free swap = 0kB
[16322.530809] Total swap = 0kB
[16322.537806] 9728 pages RAM
[16322.542105] 1485 pages reserved
[16322.553217] 261956 pages shared
[16322.566732] 7521 pages non-shared
[16322.579320] [ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name
[16322.606225] [ 58] 0 58 463 35 4 0 0 sh
[16322.623754] [ 112] 0 112 111326 5244 65 0 0 HPC03C
[16322.633654] Out of memory: Kill process 112 (HPC03C) score 612 or sacrifice child
[16322.655864] Killed process 112 (HPC03C) total-vm:445304kB, anon-rss:20244kB, file-rss:736kB
[16323.053600] codec_codec_ctl: set CODEC_TURN_OFF...
[16323.058611] codec_codec_ctl: set CODEC_TURN_OFF...
Killed
OOM信息分析
1、第一部分
[16321.605050] HPC03C invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
2、第二部分
[16321.645746] CPU: 0 PID: 119 Comm: HPC03C Tainted: G O 3.10.14 #2
[16321.667660] Stack : 00000006 8003b6c0 00000000 804b0000 00000000 00000000 00000000 00000000
00000000 00000000 80522e2a 0000003e 81e90f58 000013b9 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 816a3b00 816a3b64 80451674
804aa1c7 8003cb24 00000000 80451674 00000000 00000077 81e90f58 816a3ad8
...
[16321.858096] Call Trace:
[16321.868528] [<80020ca4>] show_stack+0x48/0x70
[16321.885701] [<803abb9c>] dump_stack+0x20/0x2c
[16321.907941] [<803aa580>] dump_header.isra.14+0x8c/0x1c4
[16321.919646] [<8009db74>] oom_kill_process+0xc4/0x44c
[16321.945295] [<8009e3ec>] out_of_memory+0x2c0/0x318
[16321.966288] [<800a1cf8>] __alloc_pages_nodemask+0x638/0x830
[16321.984326] [<8009cbd0>] filemap_fault+0x330/0x498
[16322.006701] [<800b8d40>] __do_fault+0xd0/0x4b0
[16322.028251] [<800bc6d4>] handle_pte_fault+0x334/0x84c
[16322.053548] [<800bcc8c>] handle_mm_fault+0xa0/0xe0
[16322.079625] [<80025958>] do_page_fault+0x148/0x420
[16322.084753] [<8001bec4>] resume_userspace_check+0x0/0x10
3、第三部分
[16322.119040] Mem-Info:
[16322.121490] Normal per-cpu:
[16322.130454] CPU 0: hi: 0, btch: 1 usd: 0
每个内存管理区定义了一个“每CPU”页框高速缓存,所有“每CPU”高速缓存包含一些预先分配的页框,它们被用于满足本地CPU 发出的单个页内存请求。
4、第四部分
[16322.145833] active_anon:5107 inactive_anon:3 isolated_anon:0
[16322.145833] active_file:172 inactive_file:159 isolated_file:0
[16322.145833] unevictable:0 dirty:0 writeback:0 unstable:0
[16322.145833] free:281 slab_reclaimable:171 slab_unreclaimable:750
[16322.145833] mapped:217 shmem:5 pagetables:73 bounce:0
[16322.145833] free_cma:0
5、第五部分
[16322.258017] Normal free:904kB min:720kB low:900kB high:1080kB active_anon:20428kB inactive_anon:12kB active_file:680kB inactive_file:860kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:38912kB managed:32728kB mlocked:0kB dirty:0kB writeback:0kB mapped:848kB shmem:20kB slab_reclaimable:684kB slab_unreclaimable:3000kB kernel_stack:592kB pagetables:292kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
6、第六部分
Normal: 45*4kB (UM) 6*8kB (U) 46*16kB (UM) 1*32kB (M) 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB 0*65536kB = 996kB
buddy系统信息信息, order范围0~11
7、第七部分
[16322.468905] 354 total pagecache pages
[16322.489525] 0 pages in swap cache
[16322.499744] Swap cache stats: add 0, delete 0, find 0/0
[16322.522507] Free swap = 0kB
[16322.530809] Total swap = 0kB
[16322.537806] 9728 pages RAM
[16322.542105] 1485 pages reserved
[16322.553217] 261956 pages shared
[16322.566732] 7521 pages non-shared
8、第八部分
[16322.579320] [ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name
[16322.606225] [ 58] 0 58 463 35 4 0 0 sh
[16322.623754] [ 112] 0 112 111326 5244 65 0 0 HPC03C
[16322.633654] Out of memory: Kill process 112 (HPC03C) score 612 or sacrifice child
[16322.655864] Killed process 112 (HPC03C) total-vm:445304kB, anon-rss:20244kB, file-rss:736kB
[16323.053600] codec_codec_ctl: set CODEC_TURN_OFF...
[16323.058611] codec_codec_ctl: set CODEC_TURN_OFF...
Killed