Android中,有时申请DMA内存会出现申请失败的情况,log如下:
07-06 16:14:07.541 W/Kernel ( 0): <4>[ 3162.931854] select 2346 (d.process.acore), adj 8, size 4336, to kill 07-06 16:14:07.583 W/Kernel ( 0): <4>[ 3162.938261] select 2588 (d.apps.uploader), adj 10, size 2480, to kill 07-06 16:14:07.583 W/Kernel ( 0): <4>[ 3162.944779] select 2810 (droid.browserlt), adj 10, size 29385, to kill 07-06 16:14:07.584 W/Kernel ( 0): <4>[ 3162.951331] select 3645 (e168.wowvplayer), adj 11, size 2407, to kill 07-06 16:14:07.584 W/Kernel ( 0): <4>[ 3162.957788] select 3652 (.cooliris.media), adj 11, size 2569, to kill 07-06 16:14:07.584 W/Kernel ( 0): <4>[ 3162.964257] send sigkill to 3652 (.cooliris.media), adj 11, size 2569 07-06 16:14:07.585 W/Kernel ( 0): <4>[ 3162.992879] select 2346 (d.process.acore), adj 8, size 4220, to kill 07-06 16:14:07.585 W/Kernel ( 0): <4>[ 3162.999401] select 2588 (d.apps.uploader), adj 10, size 2476, to kill 07-06 16:14:07.585 W/Kernel ( 0): <4>[ 3163.005850] select 2810 (droid.browserlt), adj 10, size 29330, to kill 07-06 16:14:07.585 W/Kernel ( 0): <4>[ 3163.012471] select 3645 (e168.wowvplayer), adj 11, size 2404, to kill 07-06 16:14:07.585 W/Kernel ( 0): <4>[ 3163.018945] send sigkill to 3645 (e168.wowvplayer), adj 11, size 2404 07-06 16:14:07.586 W/Kernel ( 0): <4>[ 3163.030391] Binder Thread #: page allocation failure. order:10, mode:0xd1 07-06 16:14:07.586 W/Kernel ( 0): <4>[ 3163.037262] [<c0080950>] (unwind_backtrace+0x0 07-06 16:14:07.586 W/Kernel ( 0): /0xf4) from [ 07-06 16:14:07.586 F/Kernel ( 0): <c00f1f5c>] (__alloc_pages_nodemask+0x408/0x580) 07-06 16:14:07.586 W/Kernel ( 0): <4>[ 3163.047111] [<c00f1f5c>] (__alloc_pages_nodemask+0x408/0x580) from [<c00813bc>] (__dma_alloc+0x80/0x2c8) 07-06 16:14:07.586 W/Kernel ( 0): <4>[ 3163.056628] [<c00813bc>] (__dma_alloc+0x80/0x2c8) from [<c0081684>] (dma_alloc_coherent+0x54/0x60) 07-06 16:14:07.586 W/Kernel ( 0): <4>[ 3163.065630] [<c0081684>] (dma_alloc_coherent+0x54/0x60) from [<c02dc920>] (mxc_v4l_do_ioctl+0x1360/0x1f1c) 07-06 16:14:07.587 W/Kernel ( 0): <4>[ 3163.075318] [<c02dc920>] (mxc_v4l_do_ioctl+0x1360/0x1f1c) from [<c02d0a00>] (video_usercopy+0x130/0x39c) 07-06 16:14:07.587 W/Kernel ( 0): <4>[ 3163. 07-06 16:14:07.588 W/Kernel ( 0): 084826] [ 07-06 16:14:07.588 F/Kernel ( 0): <c02d0a00>] (video_usercopy+0x130/0x39c) from [<c02cfdd8>] (v4l2_ioctl+0x54/0x60) 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.093472] [<c02cfdd8>] (v4l2_ioctl+0x54/0x60) from [<c0124f9c>] (vfs_ioctl+0x68/0x70) 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.101564] [<c0124f9c>] (vfs_ioctl+0x68/0x70) from [<c01254b8>] (do_vfs_ioctl+0x2f8/0x540) 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.109946] [<c01254b8>] (do_vfs_ioctl+0x2f8/0x540) from [<c0125738>] (sys_ioctl+0x38/0x60) 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.118313] [<c0125738>] (sys_ioctl+0x38/0x60) from [<c007bf80>] (ret_fast_syscall+0x0/0x30) 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.126770] Mem-info: 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 07-06 16:14:07.588 W/Kernel ( 0): 3163.129061] DMA per-cpu: 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.131598] CPU 0: hi: 18, btch: 3 usd: 0 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.136390] Normal per-cpu: 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.139201] CPU 0: hi: 90, btch: 15 usd: 0 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.144007] active_anon:24363 inactive_anon:25539 isolated_anon:0 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.144013] active_file:1871 inactive_file:2212 isolated_file:0 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.144018] unevictable:93 dirty:18 writeback:1 unstable:0 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.144024] free:16277 slab_reclaimable:469 slab_unreclaimable:1538 07-06 16:14:07.588 W/Kernel ( 0): <4>[ 3163.144030] mapped:2965 shmem:87 pagetables:22 07-06 16:14:07.589 W/Kernel ( 0): 60 bounce:0 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.173562] DMA free:42780kB min:652kB low:812kB high:976kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:97536kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:4kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.209650] lowmem_reserve[]: 0 65024 65024 65024 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.214430] Normal fr 07-06 16:14:07.589 W/Kernel ( 0): ee:22328kB min:1736kB low:2168kB high:2604kB active_anon:97452kB inactive_anon:102156kB active_file:7484kB inactive_file:8848kB unevictable:372kB isolated(anon):0kB isolated(file):0kB present:260096kB mlocked:0kB dirty:72kB writeback:4kB mapped:11860kB shmem:348kB slab_reclaimable:1876kB slab_unreclaimable:6148kB kernel_stack:2928kB pagetables:9040kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.254253] lowmem_reserve[]: 0 0 0 0 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.257970] DMA: 33*4kB 45*8k 07-06 16:14:07.589 W/Kernel ( 0): B 47*16kB 38*32kB 42*64kB 38*128kB 40*256kB 18*512kB 7*1024kB 3*2048kB 0*4096kB 0*8192kB 0*16384kB = 42780kB 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.270545] Normal: 2890*4kB 896*8kB 191*16kB 15*32kB 1*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB = 22328kB 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.283341] 4274 total pagecache pages 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.287125] 0 pages in swap cache 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.290456] Swap cache stats: add 0, delete 0, find 0/0 07-06 16:14:07.589 W/Kernel ( 0): <4>[ 3163.295684] Free swap = 0kB 07-06 16:14:07.590 W/Kernel ( 0): <4>[ 3163.298576] Total swap = 0kB 07-06 16:14:07.590 W/Kernel ( 0): <4>[ 3163.313591] 90112 pages of RAM 07-06 16:14:07.590 W/Kernel ( 0): <4 07-06 16:14:07.590 W/Kernel ( 0): >[ 3163.316651] 16792 free pages 07-06 16:14:07.591 W/Kernel ( 0): <4>[ 3163.319570] 2743 reserved pages 07-06 16:14:07.591 W/Kernel ( 0): <4>[ 3163.322712] 1491 slab pages 07-06 16:14:07.592 W/Kernel ( 0): <4>[ 3163.325505] 44555 pages shared 07-06 16:14:07.592 W/Kernel ( 0): <4>[ 3163.328575] 0 pages swap cached 07-06 16:14:07.592 E/Kernel ( 0): <3>[ 3163.331721] ERROR: v4l2 capture: mxc_allocate_frame_buf failed. 07-06 16:14:07.440 E/CameraHal( 2145): v4l_capture_setup: VIDIOC_REQBUFS failed
这里的order是用来表示申请的是多大块的内存,大小等于2^order x 4kB.
查看普通内存的使用情况:
cat /proc/meminfo
cat /proc/pagetypeinfo
top
free