簡體   English   中英

Linux Kernel memory未滿時模塊OOM

[英]Linux Kernel module OOM when memory is not full

我寫了我自己的 kernel 模塊,我得到這個錯誤:Kernel panic - not syncing: Out of memory and no killable processes... 但是當我查看 htop 時,我看到系統只使用 3G 的 700 M。 所以他們還有一個memory。

我使用自定義 linux kernel 2.6.32.61 並且在這個模塊中我必須經常分配 188 B。我使用kmem_cache_alloc()來分配這個 memory。這個錯誤很奇怪,因為它是隨機發生的。 有時我會立即收到此錯誤,當我初始化模塊時,有時模塊會運行幾分鍾。 有時我會收到此錯誤:(見下文)。

你能幫我解決這個錯誤嗎? 或者你能給我更多關於錯誤信息的信息嗎(見下文)?

在此錯誤消息中,我看到了我使用的 function,但當我查看它時,它看起來很正常,所以我不知道為什么會出現此錯誤。

謝謝您的幫助。

PS:抱歉我的英語不好

sequencer_threa invoked oom-killer: gfp_mask=0xd0, order=0, oom_adj=0
Sep 25 14:20:51 optisat kernel: [  159.043727] sequencer_threa cpuset=/ mems_allowed=0
Sep 25 14:20:51 optisat kernel: [  159.043730] Pid: 2792, comm: sequencer_threa Not tainted 2.6.32.61 #18
Sep 25 14:20:51 optisat kernel: [  159.043731] Call Trace:
Sep 25 14:20:51 optisat kernel: [  159.043736]  [<c10919ce>] oom_kill_process+0x9e/0x2c0
Sep 25 14:20:51 optisat kernel: [  159.043738]  [<c1091fcd>] ? select_bad_process+0xad/0xf0
Sep 25 14:20:51 optisat kernel: [  159.043740]  [<c1092053>] __out_of_memory+0x43/0xb0
Sep 25 14:20:51 optisat kernel: [  159.043742]  [<c1092332>] out_of_memory+0x52/0xb0
Sep 25 14:20:51 optisat kernel: [  159.043744]  [<c109517c>] __alloc_pages_nodemask+0x55c/0x570
Sep 25 14:20:51 optisat kernel: [  159.043747]  [<c12c2387>] cache_alloc_refill+0x2ea/0x5f6
Sep 25 14:20:51 optisat kernel: [  159.043750]  [<c10b5ad6>] kmem_cache_alloc+0x136/0x150
Sep 25 14:20:51 optisat kernel: [  159.043753]  [<f9d94542>] ? alloc_ts_pkt+0x12/0x30 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.043756]  [<f9d94542>] alloc_ts_pkt+0x12/0x30 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.043758]  [<f9d9190c>] build_t2_mi_pkts+0x12c/0x360 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.043760]  [<c10b5a9d>] ? kmem_cache_alloc+0xfd/0x150
Sep 25 14:20:51 optisat kernel: [  159.043763]  [<f9d92f14>] parse_ref_packet+0x13d4/0x1e50 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.043765]  [<c12c6e02>] ? _spin_unlock_irq+0x22/0x30
Sep 25 14:20:51 optisat kernel: [  159.043768]  [<c105cbcb>] ? trace_hardirqs_on+0xb/0x10
Sep 25 14:20:51 optisat kernel: [  159.043770]  [<c1050eed>] ? sched_clock_cpu+0xed/0x160
Sep 25 14:20:51 optisat kernel: [  159.043773]  [<c1023af0>] ? finish_task_switch+0x0/0xd0
Sep 25 14:20:51 optisat kernel: [  159.043776]  [<c11ca89b>] ? e1000e_set_d3_lplu_state+0x15b/0x170
Sep 25 14:20:51 optisat kernel: [  159.043778]  [<c12c6db1>] ? _spin_unlock_irqrestore+0x31/0x60
Sep 25 14:20:51 optisat kernel: [  159.043780]  [<c105cb54>] ? trace_hardirqs_on_caller+0x114/0x180
Sep 25 14:20:51 optisat kernel: [  159.043782]  [<c105cbcb>] ? trace_hardirqs_on+0xb/0x10
Sep 25 14:20:51 optisat kernel: [  159.043784]  [<f9d96ac9>] sequencer_thread+0x239/0x4a0 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.043787]  [<c104b450>] ? autoremove_wake_function+0x0/0x40
Sep 25 14:20:51 optisat kernel: [  159.043790]  [<f9d96890>] ? sequencer_thread+0x0/0x4a0 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.043792]  [<c104aea5>] kthread+0x65/0x70
Sep 25 14:20:51 optisat kernel: [  159.043794]  [<c104ae40>] ? kthread+0x0/0x70
Sep 25 14:20:51 optisat kernel: [  159.043796]  [<c10038eb>] kernel_thread_helper+0x7/0x1c
Sep 25 14:20:51 optisat kernel: [  159.043797] Mem-Info:
Sep 25 14:20:51 optisat kernel: [  159.043798] DMA per-cpu:
Sep 25 14:20:51 optisat kernel: [  159.043799] CPU    0: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.043800] CPU    1: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.043801] CPU    2: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.043802] CPU    3: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.043803] Normal per-cpu:
Sep 25 14:20:51 optisat kernel: [  159.043804] CPU    0: hi:  186, btch:  31 usd: 144
Sep 25 14:20:51 optisat kernel: [  159.043805] CPU    1: hi:  186, btch:  31 usd: 197
Sep 25 14:20:51 optisat kernel: [  159.043806] CPU    2: hi:  186, btch:  31 usd: 143
Sep 25 14:20:51 optisat kernel: [  159.043807] CPU    3: hi:  186, btch:  31 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.043808] HighMem per-cpu:
Sep 25 14:20:51 optisat kernel: [  159.043809] CPU    0: hi:  186, btch:  31 usd: 172
Sep 25 14:20:51 optisat kernel: [  159.043810] CPU    1: hi:  186, btch:  31 usd: 170
Sep 25 14:20:51 optisat kernel: [  159.043811] CPU    2: hi:  186, btch:  31 usd: 169
Sep 25 14:20:51 optisat kernel: [  159.043812] CPU    3: hi:  186, btch:  31 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.043814] active_anon:4330 inactive_anon:1137 isolated_anon:0
Sep 25 14:20:51 optisat kernel: [  159.043815]  active_file:1373 inactive_file:2388 isolated_file:0
Sep 25 14:20:51 optisat kernel: [  159.043815]  unevictable:0 dirty:79 writeback:0 unstable:0
Sep 25 14:20:51 optisat kernel: [  159.043816]  free:607286 slab_reclaimable:2764 slab_unreclaimable:190380
Sep 25 14:20:51 optisat kernel: [  159.043816]  mapped:1813 shmem:59 pagetables:160 bounce:0
Sep 25 14:20:51 optisat kernel: [  159.043819] DMA free:3460kB min:64kB low:80kB high:96kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15668kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:11592kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Sep 25 14:20:51 optisat kernel: [  159.043822] lowmem_reserve[]: 0 859 3236 3236
Sep 25 14:20:51 optisat kernel: [  159.043826] Normal free:2732kB min:3716kB low:4644kB high:5572kB active_anon:0kB inactive_anon:0kB active_file:4kB inactive_file:68kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:879840kB mlocked:0kB dirty:0kB writeback:0kB mapped:4kB shmem:0kB slab_reclaimable:11056kB slab_unreclaimable:749928kB kernel_stack:952kB pagetables:640kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:28 all_unreclaimable? no
Sep 25 14:20:51 optisat kernel: [  159.043829] lowmem_reserve[]: 0 0 19015 19015
Sep 25 14:20:51 optisat kernel: [  159.043833] HighMem free:2422952kB min:512kB low:3080kB high:5652kB active_anon:17320kB inactive_anon:4548kB active_file:5488kB inactive_file:9484kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2433944kB mlocked:0kB dirty:316kB writeback:0kB mapped:7248kB shmem:236kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Sep 25 14:20:51 optisat kernel: [  159.043836] lowmem_reserve[]: 0 0 0 0
Sep 25 14:20:51 optisat kernel: [  159.043838] DMA: 2*4kB 2*8kB 1*16kB 2*32kB 2*64kB 3*128kB 1*256kB 1*512kB 0*1024kB 1*2048kB 0*4096kB = 3432kB
Sep 25 14:20:51 optisat kernel: [  159.043844] Normal: 16*4kB 1*8kB 0*16kB 0*32kB 1*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 1*2048kB 0*4096kB = 2824kB
Sep 25 14:20:51 optisat kernel: [  159.043850] HighMem: 1485*4kB 808*8kB 471*16kB 204*32kB 99*64kB 36*128kB 5*256kB 1*512kB 2*1024kB 3*2048kB 580*4096kB = 2423076kB
Sep 25 14:20:51 optisat kernel: [  159.043855] 3815 total pagecache pages
Sep 25 14:20:51 optisat kernel: [  159.043856] 0 pages in swap cache
Sep 25 14:20:51 optisat kernel: [  159.043857] Swap cache stats: add 0, delete 0, find 0/0
Sep 25 14:20:51 optisat kernel: [  159.043858] Free swap  = 1316856kB
Sep 25 14:20:51 optisat kernel: [  159.043859] Total swap = 1316856kB
Sep 25 14:20:51 optisat kernel: [  159.048960] 849904 pages RAM
Sep 25 14:20:51 optisat kernel: [  159.048961] 622594 pages HighMem
Sep 25 14:20:51 optisat kernel: [  159.048962] 35058 pages reserved
Sep 25 14:20:51 optisat kernel: [  159.048963] 8458 pages shared
Sep 25 14:20:51 optisat kernel: [  159.048964] 202716 pages non-shared
Sep 25 14:20:51 optisat kernel: [  159.048965] Out of memory: kill process 2797 (make) score 2343 or a child
Sep 25 14:20:51 optisat kernel: [  159.049026] Killed process 2998 (beam.smp)
Sep 25 14:20:51 optisat kernel: [  159.094076] sequencer_threa invoked oom-killer: gfp_mask=0xd0, order=0, oom_adj=0
Sep 25 14:20:51 optisat kernel: [  159.094080] sequencer_threa cpuset=/ mems_allowed=0
Sep 25 14:20:51 optisat kernel: [  159.094082] Pid: 2792, comm: sequencer_threa Not tainted 2.6.32.61 #18
Sep 25 14:20:51 optisat kernel: [  159.094084] Call Trace:
Sep 25 14:20:51 optisat kernel: [  159.094088]  [<c10919ce>] oom_kill_process+0x9e/0x2c0
Sep 25 14:20:51 optisat kernel: [  159.094090]  [<c1091fcd>] ? select_bad_process+0xad/0xf0
Sep 25 14:20:51 optisat kernel: [  159.094092]  [<c1092053>] __out_of_memory+0x43/0xb0
Sep 25 14:20:51 optisat kernel: [  159.094094]  [<c1092332>] out_of_memory+0x52/0xb0
Sep 25 14:20:51 optisat kernel: [  159.094097]  [<c109517c>] __alloc_pages_nodemask+0x55c/0x570
Sep 25 14:20:51 optisat kernel: [  159.094100]  [<c12c2387>] cache_alloc_refill+0x2ea/0x5f6
Sep 25 14:20:51 optisat kernel: [  159.094103]  [<c10b5ad6>] kmem_cache_alloc+0x136/0x150
Sep 25 14:20:51 optisat kernel: [  159.094107]  [<f9d94542>] ? alloc_ts_pkt+0x12/0x30 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.094109]  [<f9d94542>] alloc_ts_pkt+0x12/0x30 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.094111]  [<f9d92b04>] parse_ref_packet+0xfc4/0x1e50 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.094114]  [<c105a89b>] ? trace_hardirqs_off+0xb/0x10
Sep 25 14:20:51 optisat kernel: [  159.094116]  [<c1050f05>] ? sched_clock_cpu+0x105/0x160
Sep 25 14:20:51 optisat kernel: [  159.094119]  [<c1050eed>] ? sched_clock_cpu+0xed/0x160
Sep 25 14:20:51 optisat kernel: [  159.094121]  [<c10b45e3>] ? cache_free_debugcheck+0xe3/0x300
Sep 25 14:20:51 optisat kernel: [  159.094124]  [<c113d465>] ? __debug_check_no_obj_freed+0x125/0x190
Sep 25 14:20:51 optisat kernel: [  159.094125]  [<c105a89b>] ? trace_hardirqs_off+0xb/0x10
Sep 25 14:20:51 optisat kernel: [  159.094128]  [<c105cbcb>] ? trace_hardirqs_on+0xb/0x10
Sep 25 14:20:51 optisat kernel: [  159.094130]  [<f9d969da>] sequencer_thread+0x14a/0x4a0 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.094134]  [<c104b450>] ? autoremove_wake_function+0x0/0x40
Sep 25 14:20:51 optisat kernel: [  159.094136]  [<f9d96890>] ? sequencer_thread+0x0/0x4a0 [optimux_rx]
Sep 25 14:20:51 optisat kernel: [  159.094139]  [<c104aea5>] kthread+0x65/0x70
Sep 25 14:20:51 optisat kernel: [  159.094141]  [<c104ae40>] ? kthread+0x0/0x70
Sep 25 14:20:51 optisat kernel: [  159.094143]  [<c10038eb>] kernel_thread_helper+0x7/0x1c
Sep 25 14:20:51 optisat kernel: [  159.094144] Mem-Info:
Sep 25 14:20:51 optisat kernel: [  159.094145] DMA per-cpu:
Sep 25 14:20:51 optisat kernel: [  159.094146] CPU    0: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.094147] CPU    1: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.094148] CPU    2: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.094149] CPU    3: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.094150] Normal per-cpu:
Sep 25 14:20:51 optisat kernel: [  159.094152] CPU    0: hi:  186, btch:  31 usd: 165
Sep 25 14:20:51 optisat kernel: [  159.094153] CPU    1: hi:  186, btch:  31 usd: 204
Sep 25 14:20:51 optisat kernel: [  159.094154] CPU    2: hi:  186, btch:  31 usd: 143
Sep 25 14:20:51 optisat kernel: [  159.094155] CPU    3: hi:  186, btch:  31 usd:  33
Sep 25 14:20:51 optisat kernel: [  159.094156] HighMem per-cpu:
Sep 25 14:20:51 optisat kernel: [  159.094156] CPU    0: hi:  186, btch:  31 usd: 172
Sep 25 14:20:51 optisat kernel: [  159.094157] CPU    1: hi:  186, btch:  31 usd: 170
Sep 25 14:20:51 optisat kernel: [  159.094158] CPU    2: hi:  186, btch:  31 usd: 169
Sep 25 14:20:51 optisat kernel: [  159.094160] CPU    3: hi:  186, btch:  31 usd: 116
Sep 25 14:20:51 optisat kernel: [  159.094162] active_anon:4329 inactive_anon:1041 isolated_anon:0
Sep 25 14:20:51 optisat kernel: [  159.094163]  active_file:1394 inactive_file:2381 isolated_file:0
Sep 25 14:20:51 optisat kernel: [  159.094163]  unevictable:0 dirty:92 writeback:0 unstable:0
Sep 25 14:20:51 optisat kernel: [  159.094164]  free:607290 slab_reclaimable:2518 slab_unreclaimable:190594
Sep 25 14:20:51 optisat kernel: [  159.094165]  mapped:1744 shmem:59 pagetables:155 bounce:0
Sep 25 14:20:51 optisat kernel: [  159.094168] DMA free:3460kB min:64kB low:80kB high:96kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15668kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:11592kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Sep 25 14:20:51 optisat kernel: [  159.094171] lowmem_reserve[]: 0 859 3236 3236
Sep 25 14:20:51 optisat kernel: [  159.094175] Normal free:2872kB min:3716kB low:4644kB high:5572kB active_anon:0kB inactive_anon:0kB active_file:4kB inactive_file:68kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:879840kB mlocked:0kB dirty:0kB writeback:0kB mapped:4kB shmem:0kB slab_reclaimable:10072kB slab_unreclaimable:750784kB kernel_stack:952kB pagetables:620kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Sep 25 14:20:51 optisat kernel: [  159.094179] lowmem_reserve[]: 0 0 19015 19015
Sep 25 14:20:51 optisat kernel: [  159.094183] HighMem free:2422828kB min:512kB low:3080kB high:5652kB active_anon:17316kB inactive_anon:4164kB active_file:5572kB inactive_file:9456kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2433944kB mlocked:0kB dirty:368kB writeback:0kB mapped:6972kB shmem:236kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Sep 25 14:20:51 optisat kernel: [  159.094186] lowmem_reserve[]: 0 0 0 0
Sep 25 14:20:51 optisat kernel: [  159.094188] DMA: 2*4kB 2*8kB 1*16kB 2*32kB 2*64kB 3*128kB 1*256kB 1*512kB 0*1024kB 1*2048kB 0*4096kB = 3432kB
Sep 25 14:20:51 optisat kernel: [  159.094194] Normal: 28*4kB 1*8kB 0*16kB 0*32kB 1*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 1*2048kB 0*4096kB = 2872kB
Sep 25 14:20:51 optisat kernel: [  159.094200] HighMem: 1454*4kB 808*8kB 471*16kB 204*32kB 99*64kB 36*128kB 5*256kB 1*512kB 2*1024kB 3*2048kB 580*4096kB = 2422952kB
Sep 25 14:20:51 optisat kernel: [  159.094206] 3790 total pagecache pages
Sep 25 14:20:51 optisat kernel: [  159.094207] 0 pages in swap cache
Sep 25 14:20:51 optisat kernel: [  159.094208] Swap cache stats: add 0, delete 0, find 0/0
Sep 25 14:20:51 optisat kernel: [  159.094209] Free swap  = 1316856kB
Sep 25 14:20:51 optisat kernel: [  159.094209] Total swap = 1316856kB
Sep 25 14:20:51 optisat kernel: [  159.099045] 849904 pages RAM
Sep 25 14:20:51 optisat kernel: [  159.099046] 622594 pages HighMem
Sep 25 14:20:51 optisat kernel: [  159.099047] 35058 pages reserved
Sep 25 14:20:51 optisat kernel: [  159.099048] 8161 pages shared
Sep 25 14:20:51 optisat kernel: [  159.099048] 202610 pages non-shared
Sep 25 14:20:51 optisat kernel: [  159.099050] Out of memory: kill process 2459 (dbus-daemon) score 743 or a child
Sep 25 14:20:51 optisat kernel: [  159.099114] Killed process 2459 (dbus-daemon)
Sep 25 14:20:51 optisat kernel: [  159.112749] htop invoked oom-killer: gfp_mask=0x800d0, order=0, oom_adj=0
Sep 25 14:20:51 optisat kernel: [  159.112753] htop cpuset=/ mems_allowed=0
Sep 25 14:20:51 optisat kernel: [  159.112755] Pid: 3074, comm: htop Not tainted 2.6.32.61 #18
Sep 25 14:20:51 optisat kernel: [  159.112756] Call Trace:
Sep 25 14:20:51 optisat kernel: [  159.112761]  [<c10919ce>] oom_kill_process+0x9e/0x2c0
Sep 25 14:20:51 optisat kernel: [  159.112764]  [<c1091fcd>] ? select_bad_process+0xad/0xf0
Sep 25 14:20:51 optisat kernel: [  159.112766]  [<c1092053>] __out_of_memory+0x43/0xb0
Sep 25 14:20:51 optisat kernel: [  159.112768]  [<c1092332>] out_of_memory+0x52/0xb0
Sep 25 14:20:51 optisat kernel: [  159.112770]  [<c109517c>] __alloc_pages_nodemask+0x55c/0x570
Sep 25 14:20:51 optisat kernel: [  159.112773]  [<c1101430>] ? proc_info_read+0x0/0xc0
Sep 25 14:20:51 optisat kernel: [  159.112776]  [<c10951a7>] __get_free_pages+0x17/0x30
Sep 25 14:20:51 optisat kernel: [  159.112778]  [<c110146b>] proc_info_read+0x3b/0xc0
Sep 25 14:20:51 optisat kernel: [  159.112780]  [<c1101430>] ? proc_info_read+0x0/0xc0
Sep 25 14:20:51 optisat kernel: [  159.112783]  [<c10bfa34>] vfs_read+0x84/0x180
Sep 25 14:20:51 optisat kernel: [  159.112785]  [<c1101430>] ? proc_info_read+0x0/0xc0
Sep 25 14:20:51 optisat kernel: [  159.112787]  [<c10bfb68>] sys_read+0x38/0x70
Sep 25 14:20:51 optisat kernel: [  159.112789]  [<c1002cd4>] sysenter_do_call+0x12/0x32
Sep 25 14:20:51 optisat kernel: [  159.112790] Mem-Info:
Sep 25 14:20:51 optisat kernel: [  159.112791] DMA per-cpu:
Sep 25 14:20:51 optisat kernel: [  159.112792] CPU    0: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.112794] CPU    1: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.112795] CPU    2: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.112796] CPU    3: hi:    0, btch:   1 usd:   0
Sep 25 14:20:51 optisat kernel: [  159.112797] Normal per-cpu:
Sep 25 14:20:51 optisat kernel: [  159.112798] CPU    0: hi:  186, btch:  31 usd:  53
Sep 25 14:20:51 optisat kernel: [  159.112800] CPU    1: hi:  186, btch:  31 usd: 175
Sep 25 14:20:51 optisat kernel: [  159.112801] CPU    2: hi:  186, btch:  31 usd: 160
Sep 25 14:20:51 optisat kernel: [  159.112802] CPU    3: hi:  186, btch:  31 usd:  57
Sep 25 14:20:51 optisat kernel: [  159.112803] HighMem per-cpu:
Sep 25 14:20:51 optisat kernel: [  159.112804] CPU    0: hi:  186, btch:  31 usd: 172
Sep 25 14:20:51 optisat kernel: [  159.112805] CPU    1: hi:  186, btch:  31 usd: 170
Sep 25 14:20:51 optisat kernel: [  159.112806] CPU    2: hi:  186, btch:  31 usd: 157
Sep 25 14:20:51 optisat kernel: [  159.112807] CPU    3: hi:  186, btch:  31 usd: 113
Sep 25 14:20:51 optisat kernel: [  159.112810] active_anon:4201 inactive_anon:1114 isolated_anon:0
Sep 25 14:20:51 optisat kernel: [  159.112811]  active_file:1394 inactive_file:2326 isolated_file:0
Sep 25 14:20:51 optisat kernel: [  159.112811]  unevictable:0 dirty:92 writeback:0 unstable:0
Sep 25 14:20:51 optisat kernel: [  159.112812]  free:607509 slab_reclaimable:2518 slab_unreclaimable:190569
Sep 25 14:20:51 optisat kernel: [  159.112813]  mapped:1744 shmem:59 pagetables:155 bounce:0
Sep 25 14:20:51 optisat kernel: [  159.112816] DMA free:3460kB min:64kB low:80kB high:96kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15668kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:11592kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
Sep 25 14:20:51 optisat kernel: [  159.112819] lowmem_reserve[]: 0 859 3236 3236
Sep 25 14:20:51 optisat kernel: [  159.112824] Normal free:3500kB min:3716kB low:4644kB high:5572kB active_anon:0kB inactive_anon:0kB active_file:4kB inactive_file:68kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:879840kB mlocked:0kB dirty:0kB writeback:0kB mapped:4kB shmem:0kB slab_reclaimable:10072kB slab_unreclaimable:750784kB kernel_stack:952kB pagetables:620kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Sep 25 14:20:51 optisat kernel: [  159.112828] lowmem_reserve[]: 0 0 19015 19015
Sep 25 14:20:51 optisat kernel: [  159.112832] HighMem free:2423076kB min:512kB low:3080kB high:5652kB active_anon:16804kB inactive_anon:4456kB active_file:5572kB inactive_file:9236kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2433944kB mlocked:0kB dirty:368kB writeback:0kB mapped:6972kB shmem:236kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:96 all_unreclaimable? no
Sep 25 14:20:51 optisat kernel: [  159.112836] lowmem_reserve[]: 0 0 0 0
Sep 25 14:20:51 optisat kernel: [  159.112838] DMA: 2*4kB 2*8kB 1*16kB 2*32kB 2*64kB 3*128kB 1*256kB 1*512kB 0*1024kB 1*2048kB 0*4096kB = 3432kB
Sep 25 14:20:51 optisat kernel: [  159.112844] Normal: 161*4kB 12*8kB 1*16kB 0*32kB 1*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 1*2048kB 0*4096kB = 3508kB
Sep 25 14:20:51 optisat kernel: [  159.112850] HighMem: 1440*4kB 802*8kB 471*16kB 211*32kB 101*64kB 36*128kB 5*256kB 1*512kB 2*1024kB 3*2048kB 580*4096kB = 2423200kB
Sep 25 14:20:51 optisat kernel: [  159.112856] 3790 total pagecache pages
Sep 25 14:20:51 optisat kernel: [  159.112857] 0 pages in swap cache
Sep 25 14:20:51 optisat kernel: [  159.112858] Swap cache stats: add 0, delete 0, find 0/0
Sep 25 14:20:51 optisat kernel: [  159.112859] Free swap  = 1316856kB
Sep 25 14:20:51 optisat kernel: [  159.112860] Total swap = 1316856kB
Sep 25 14:20:51 optisat kernel: [  159.117742] 849904 pages RAM
Sep 25 14:20:51 optisat kernel: [  159.117743] 622594 pages HighMem
Sep 25 14:20:51 optisat kernel: [  159.117744] 35058 pages reserved
Sep 25 14:20:51 optisat kernel: [  159.117745] 8060 pages shared
Sep 25 14:20:51 optisat kernel: [  159.117746] 202704 pages non-shared
Sep 25 14:20:51 optisat kernel: [  159.117748] Out of memory: kill process 1897 (rpc.statd) score 601 or a child
Sep 25 14:20:51 optisat kernel: [  159.117808] Killed process 1897 (rpc.statd)

造成內存不足問題的原因有很多,首先是kmem_cache_create()請求缺乏足夠大的連續內存的可用性。 請注意,我從提供的輸出中懷疑kmem_cache_create()使用SLAB層。

dmesg輸出中似乎缺少一行,后面是一個類似於以下內容的表,該表應提供有關導致OOM錯誤的進程的更多信息,以及oom_adj得分和該進程使用的駐留內存。 oom_adj_score越高,該進程被殺死的可能性就越大。

kernel: [ pid ]   uid  tgid total_vm      rss cpu oom_adj oom_score_adj name 

嘗試使用以下命令在dmesg輸出中獲取更多信息:dmesg -l info,notice,warn,err,crit,alert,emerg

另外,您可能還需要考慮在/etc/sysctl.conf文件中設置以下內容並運行sysctl -p (以避免重新啟動):

vm.overcommit_memory = 2
vm.overcommit_ratio = 80

參考此鏈接

看起來系統正在運行 32 位 kernel,即使有可用的可用 RAM,它也可能會用完虛擬 memory 地址。 32 位內核可以有效地處理高達 2 GB 左右的實際 RAM,而沒有“有趣”的限制。

此處有趣的 kernel 日志行如下所示:

Sep 25 14:20:51 optisat kernel: [  159.043826] Normal free:2732kB min:3716kB low:4644kB high:5572kB active_anon:0kB inactive_anon:0kB active_file:4kB inactive_file:68kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:879840kB mlocked:0kB dirty:0kB writeback:0kB mapped:4kB shmem:0kB slab_reclaimable:11056kB slab_unreclaimable:749928kB kernel_stack:952kB pagetables:640kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:28 all_unreclaimable? no

請注意Normal free:2732kB min:3716kB部分,它表示正常 memory 區域(適合 32 位尋址空間的部分)低於最小值,這將停止所有嘗試請求更多 RAM 的用戶進程,直到可以釋放一些內存。 因此,當高 memory 區域仍有 2.4 GB 可用空間時,您的正常 memory 區域只有 2.7 MB 可用空間。

解決該問題的唯一真正方法是升級到 64 位操作系統,但調整系統以減少“正常”memory 區域使用也可能有所幫助。 例如,有些人注意到禁用網絡適配器硬件加速會大大減少正常的 memory 區域使用量。

使用避免mmap()和其他需要大塊虛擬 memory 地址的函數的用戶模式程序也可能有所幫助。 然而,因為mmap()不是 64 位操作系統的問題並且使用它通常可以提高運行時性能,所以大多數現代應用程序實際上更喜歡對所有內容使用mmap() 這使得在現代操作系統和應用程序中使用 32 位操作系統變得更糟。

另請注意,某些安全功能(例如 KASRL)需要比 32 位更大的地址空間才能有效實現,因此使用 32 位操作系統也會降低系統的安全性。

TL;DR:如果您需要處理任何大於 2 GB 的文件或在您的系統上安裝超過 2 GB 的 RAM,您應該運行 64 位操作系統。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM