Eu tenho um problema de alocação de memória em um Linux NOMMU incorporado. Ou seja, eu poderia ter um problema, não tenho certeza.
O sistema tem 15M de RAM livre quando inicializado. Eu tenho um pequeno aplicativo (um aplicativo de comunicação Dropbox / REST) que aloca até 500k.
De vez em quando, o kernel lançará um relatório de erros de alocação. Assim:
=============================================== ===
Aug 25 08:11:57 kernel: Source : <0x00011058> { ___local_bh_enable + 0x38 } RTS
Aug 25 08:11:57 kernel: CPU: 0 PID: 17233 Comm: dropbox Not tainted 3.10.10-ADI-2013R1-svn10397 #747
Aug 25 08:11:57 kernel: Stack info:
Aug 25 08:11:57 kernel: SP: [0x01d73d8c] <0x01d73d8c> /* kernel dynamic memory */
Aug 25 08:11:57 kernel: FP: (0x01d73eec)
Aug 25 08:11:57 kernel: Memory from 0x01d73d80 to 01d74000
Aug 25 08:11:57 kernel: 01d73d80: 00000000 01d73d8c 00000000 [00000000] 00041580 00210cd8 000000d0 00210ce4
Aug 25 08:11:57 kernel: 01d73da0: 01752c64 00000007 000000d0 0004186c 00210cd8 00000000 00041888 00000000
Aug 25 08:11:57 kernel: 01d73dc0: 000000d0 00000001 00000010 000000d0 00000000 00000007 00210cd8 00000001
Aug 25 08:11:57 kernel: 01d73de0: 00000040 002103e4 00000000 01d72008 01d72000 01d72008 01d72000 00000040
Aug 25 08:11:57 kernel: 01d73e00: 01d72000 01d73eec 00000080 0000002f 0000002f 00000040 00000000 00000040
Aug 25 08:11:57 kernel: 01d73e20: 002103e4 00000000 00000000 002103e4 002103e4 00418e50 0004cc20 00000000
Aug 25 08:11:57 kernel: 01d73e40: 00a441d8 009447c0 00000000 000000ff 00000007 00000008 00000000 00000007
Aug 25 08:11:57 kernel: 01d73e60: 00000000 00000000 00000002 00000042 00042000 00000042 00100100 00200200
Aug 25 08:11:57 kernel: 01d73e80: 01ebfaf0 0004879c 00000000 00041038 <00731bb0> 009447c0 015e0694 00000000
Aug 25 08:11:57 kernel: 01d73ea0: 00041038 00000001 00000001 00100100 00000005 00000002 00000000 01d73ec0
Aug 25 08:11:57 kernel: 01d73ec0: 00000000 0004c81c 00001802 009447c0 00000005 00000000 00001000 53faefc4
Aug 25 08:11:57 kernel: 01d73ee0: 0ca2dd00 00000005 00000002 (00000000) 0004c7e0 000000c0 00000000
Aug 25 08:11:57 kernel: 01d73fc0:<00751278><00731bb0> 00731d24 00711000 000000c0 7ffff000 00000000 00000000
Aug 25 08:11:57 kernel: 01d73fe0: 00000003 00001802 00000005 00041038 00000000 00000000 000000c0 00000006
Aug 25 08:11:57 kernel: Return addresses in stack:
Aug 25 08:11:57 kernel: address : <0x00731bb0> /* kernel dynamic memory */
Aug 25 08:11:57 kernel: frame 1 : <0xffa0071e> { _system_call + 0x6a }
Aug 25 08:11:57 kernel: address : <0x00751278> /* kernel dynamic memory */
Aug 25 08:11:57 kernel: address : <0x00731bb0> /* kernel dynamic memory */
Aug 25 08:11:57 kernel: Mem-Info:
Aug 25 08:11:57 kernel: DMA per-cpu:
Aug 25 08:11:57 kernel: CPU 0: hi: 0, btch: 1 usd: 0
Aug 25 08:11:57 kernel: active_anon:0 inactive_anon:0 isolated_anon:0
Aug 25 08:11:57 kernel: active_file:437 inactive_file:433 isolated_file:0
Aug 25 08:11:57 kernel: unevictable:1239 dirty:11 writeback:0 unstable:0
Aug 25 08:11:57 kernel: free:2571 slab_reclaimable:849 slab_unreclaimable:416
Aug 25 08:11:57 kernel: mapped:0 shmem:0 pagetables:0 bounce:0
Aug 25 08:11:57 kernel: free_cma:0
Aug 25 08:11:57 kernel: DMA free:10284kB min:4096kB low:5120kB high:6144kB active_anon:0kB inactive_anon:0kB active_file:1748kB inactive_file:1732kB unevictable:4956kB isolated(anon):0kB isolated(file):0kB present:31744kB managed:25176kB mlocked:0kB d
Aug 25 08:11:57 kernel: lowmem_reserve[]: 0 0 0
Aug 25 08:11:57 kernel: DMA: 249*4kB (UM) 41*8kB (U) 6*16kB (UM) 79*32kB (U) 85*64kB (UM) 1*128kB (U) 1*256kB (U) 1*512kB (U) 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 10284kB
Aug 25 08:11:57 kernel: 2109 total pagecache pages
Aug 25 08:11:58 kernel: CPU 0: hi: 0, btch: 1 usd: 0
Aug 25 08:11:58 kernel: active_anon:0 inactive_anon:0 isolated_anon:0
Aug 25 08:11:58 kernel: active_file:437 inactive_file:433 isolated_file:0
Aug 25 08:11:58 kernel: unevictable:1239 dirty:11 writeback:0 unstable:0
Aug 25 08:11:58 kernel: free:2571 slab_reclaimable:849 slab_unreclaimable:416
Aug 25 08:11:58 kernel: mapped:0 shmem:0 pagetables:0 bounce:0
Aug 25 08:11:58 kernel: free_cma:0
Aug 25 08:11:58 kernel: DMA free:10284kB min:4096kB low:5120kB high:6144kB active_anon:0kB inactive_anon:0kB active_file:1748kB inactive_file:1732kB unevictable:4956kB isolated(anon):0kB isolated(file):0kB present:31744kB managed:25176kB mlocked:0kB d
Aug 25 08:11:58 kernel: lowmem_reserve[]: 0 0 0
Aug 25 08:11:58 kernel: DMA: 249*4kB (UM) 41*8kB (U) 6*16kB (UM) 79*32kB (U) 85*64kB (UM) 1*128kB (U) 1*256kB (U) 1*512kB (U) 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 10284kB
Aug 25 08:11:58 kernel: 2109 total pagecache pages
Aug 25 08:11:58 kernel: dropbox: page allocation failure: order:7, mode:0xd0
Aug 25 08:11:58 kernel: Hardware Trace:
Aug 25 08:11:58 kernel: 0 Target : <0x00171b8c> { _dump_stack + 0x0 }
Aug 25 08:11:58 kernel: Source : <0x0004157c> { _warn_alloc_failed + 0xa4 } CALL pcrel
Aug 25 08:11:58 kernel: 1 Target : <0x0004157c> { _warn_alloc_failed + 0xa4 }
Aug 25 08:11:58 kernel: Source : <0x00171df6> { _printk + 0x26 } RTS
Aug 25 08:11:58 kernel: 2 Target : <0x00171df2> { _printk + 0x22 }
Aug 25 08:11:58 kernel: Source : <0x0000d7c8> { _vprintk_emit + 0x12c } RTS
Aug 25 08:11:58 kernel: 3 Target : <0x0000d7be> { _vprintk_emit + 0x122 }
Aug 25 08:11:58 kernel: Source : <0xffa00ad4> { __common_int_entry + 0xcc } RTI
Aug 25 08:11:58 kernel: 4 Target : <0xffa00a72> { __common_int_entry + 0x6a }
Aug 25 08:11:58 kernel: Source : <0xffa008b8> { _return_from_int + 0x58 } RTS
Aug 25 08:11:58 kernel: 5 Target : <0xffa008b8> { _return_from_int + 0x58 }
Aug 25 08:11:58 kernel: Source : <0xffa0088e> { _return_from_int + 0x2e } IF !CC JUMP pcrel
Aug 25 08:11:58 kernel: 6 Target : <0xffa00860> { _return_from_int + 0x0 }
Aug 25 08:11:58 kernel: Source : <0xffa00a6e> { __common_int_entry + 0x66 } JUMP.L
Aug 25 08:11:58 kernel: 10 Target : <0x0003b366> { _rcu_irq_exit + 0x32 }
Aug 25 08:11:58 kernel: Source : <0x0003b2da> { _rcu_idle_enter_common + 0x56 } RTS
Aug 25 08:11:58 kernel: 11 Target : <0x0003b2c8> { _rcu_idle_enter_common + 0x44 }
Aug 25 08:11:58 kernel: Source : <0x0003b290> { _rcu_idle_enter_common + 0xc } IF !CC JUMP pcrel
Aug 25 08:11:58 kernel: 12 Target : <0x0003b284> { _rcu_idle_enter_common + 0x0 }
Aug 25 08:11:58 kernel: Source : <0x0003b362> { _rcu_irq_exit + 0x2e } CALL pcrel
Aug 25 08:11:58 kernel: 13 Target : <0x0003b334> { _rcu_irq_exit + 0x0 }
Aug 25 08:11:58 kernel: Source : <0x00011872> { _irq_exit + 0x56 } CALL pcrel
Aug 25 08:11:58 kernel: 14 Target : <0x0001186e> { _irq_exit + 0x52 }
Aug 25 08:11:58 kernel: Source : <0x00011798> { ___do_softirq + 0x128 } RTS
Aug 25 08:11:58 kernel: 15 Target : <0x00011776> { ___do_softirq + 0x106 }
Aug 25 08:11:58 kernel: Source : <0x00011058> { ___local_bh_enable + 0x38 } RTS
Aug 25 08:11:58 kernel: CPU: 0 PID: 17233 Comm: dropbox Not tainted 3.10.10-ADI-2013R1-svn10397 #747
Aug 25 08:11:58 kernel: Stack info:
Aug 25 08:11:58 kernel: SP: [0x01d73d8c] <0x01d73d8c> /* kernel dynamic memory */
Aug 25 08:11:58 kernel: FP: (0x01d73eec)
Aug 25 08:11:58 kernel: Memory from 0x01d73d80 to 01d74000
Aug 25 08:11:58 kernel: 01d73d80: 00000000 01d73d8c 00000000 [00000000] 00041580 00210cd8 000000d0 00210ce4
Aug 25 08:11:58 kernel: 01d73e40: 017a6798 0038bac0 00000000 000000ff 00000007 00000008 00000000 00000007
Aug 25 08:11:58 kernel: 01d73e60: 00000000 00000000 00000002 00000042 00042000 00000042 00100100 00200200
Aug 25 08:11:58 kernel: 01d73e80: 01ebf2a4 0004879c 00000000 00041038 <00731bb0> 0038bac0 015e0694 00000000
Aug 25 08:11:58 kernel: 01d73ea0: 00041038 00000001 00000001 00100100 00000005 00000002 00000000 01d73ec0
Aug 25 08:11:58 kernel: 01d73ec0: 00000000 0004c81c 00001802 0038bac0 00000005 00000000 00001000 53faefcd
Aug 25 08:11:58 kernel: 01d73ee0: 0b71b000 00000005 00000002 (00000000) 0004c7e0 000000c0 00000000
Aug 25 08:11:58 kernel: 01d73f00: ffffe000 00000000 00000003 <00731bb0> 00000100 ffffe000 00001802 00000003
Aug 25 08:11:58 kernel: 01d73f20: 00000000 0021ab00 00008000 00002000 00000000 01d74000 0021ab00 0021ab00
Aug 25 08:11:58 kernel: 01d73f40: 0021a436 ffa00e2c 02002021 0021ad93 016dd77b 0021ad90 016dd77a 00000000
Aug 25 08:11:58 kernel: 01d73f60: 00000000 00000004 00000000 00000004 00000000 00000000 7ffff000 000000c0
Aug 25 08:11:58 kernel: 01d73f80: 00000137 00000000 00000000 00000000 00000000 0000005b 00001802 00000001
Aug 25 08:11:58 kernel: 01d73fa0: 000000b4 00000000 00000002 00000fff 00001454 01ebf1a0 01ebf2a4 00711034
Aug 25 08:11:58 kernel: 01d73fc0: 00751294 <00731bb0> 00731d24 00711000 000000c0 7ffff000 00000000 00000000
Aug 25 08:11:58 kernel: 01d73fe0: 00000003 00001802 00000005 00041038 00000000 00000000 000000c0 00000006
Aug 25 08:11:58 kernel: Return addresses in stack:
Aug 25 08:11:58 kernel: address : <0x00731bb0> /* kernel dynamic memory */
Aug 25 08:11:58 kernel: frame 1 : <0xffa0071e> { _system_call + 0x6a }
Aug 25 08:11:58 kernel: address : <0x00731bb0> /* kernel dynamic memory */
Aug 25 08:11:58 kernel: address : <0x00731bb0> /* kernel dynamic memory */
Aug 25 08:11:58 kernel: Mem-Info:
Aug 25 08:11:58 kernel: DMA per-cpu:
Aug 25 08:11:58 kernel: CPU 0: hi: 0, btch: 1 usd: 0
Aug 25 08:11:58 kernel: active_anon:0 inactive_anon:0 isolated_anon:0
Aug 25 08:11:58 kernel: active_file:63 inactive_file:392 isolated_file:0
Aug 25 08:11:58 kernel: unevictable:1239 dirty:11 writeback:0 unstable:0
Aug 25 08:11:58 kernel: free:3149 slab_reclaimable:681 slab_unreclaimable:417
Aug 25 08:11:58 kernel: mapped:0 shmem:0 pagetables:0 bounce:0
Aug 25 08:11:58 kernel: free_cma:0
Aug 25 08:11:58 kernel: DMA free:12596kB min:4096kB low:5120kB high:6144kB active_anon:0kB inactive_anon:0kB active_file:252kB inactive_file:1568kB unevictable:4956kB isolated(anon):0kB isolated(file):0kB present:31744kB managed:25176kB mlocked:0kB di
Aug 25 08:11:58 kernel: lowmem_reserve[]: 0 0 0
Aug 25 08:11:58 kernel: DMA: 393*4kB (UM) 126*8kB (U) 40*16kB (UM) 81*32kB (U) 78*64kB (UM) 8*128kB (U) 1*256kB (U) 1*512kB (U) 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 12596kB
Aug 25 08:11:58 kernel: 1696 total pagecache pages
Aug 25 08:11:58 kernel: 7936 pages RAM
Aug 25 08:11:58 kernel: 614 pages reserved
Aug 25 08:11:58 kernel: 262586 pages shared
Aug 25 08:11:58 kernel: 3706 pages non-shared
Aug 25 08:11:58 kernel: Allocation of length 270336 from process 17233 (dropbox) failed
Aug 25 08:11:58 kernel: DMA per-cpu:
Aug 25 08:11:58 kernel: CPU 0: hi: 0, btch: 1 usd: 0
Aug 25 08:11:58 kernel: active_anon:0 inactive_anon:0 isolated_anon:0
Aug 25 08:11:58 kernel: active_file:63 inactive_file:392 isolated_file:0
Aug 25 08:11:58 kernel: DMA: 393*4kB (UM) 126*8kB (U) 40*16kB (UM) 81*32kB (U) 78*64kB (UM) 8*128kB (U) 1*256kB (U) 1*512kB (U) 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 12596kB
Aug 25 08:11:58 kernel: 1696 total pagecache pages
=============================================== ===
O sistema não parece sofrer. Continua. Parece que o kernel pode despejar parte do cache, quando acontece: link Mas eu não tenho certeza.
Além disso, o kernel é compilado com recursos de depuração incluídos. Os relatórios podem não vir se eu construí-lo no modo 'release'.
Minha pergunta é: isso é algo que eu deveria estar preocupado? (Não parece muito bom.)
Existe uma maneira de desabilitar ou reduzir o cache? Eu imagino que o cache criará esses problemas em sistemas NOMMU, já que o kernel não pode realocar mem-on-the-fly, como acontece com uma MMU.
Btw, é um ucLinux, kernel 3.10.
Tags linux out-of-memory uclinux