查看Linux中DMA的大小 | 您所在的位置:网站首页 › 在哪里学唱歌可以到录音棚录歌 › 查看Linux中DMA的大小 |
操作系统会将内存分段,分页,分区,本文讲linux下的内存分区。 在64位的操作系统中,内存划分为DMA、MDA32、Normal区。 DMADirect memory access, or DMA, is the advanced topic that completes our overview of memory issues. DMA is the hardware mechanism that allows peripheral components to transfer their I/O data directly to and from main memory without the need to involve the system processor. Use of this mechanism can greatly increase throughput to and from a device, because a great deal of computational overhead is eliminated. 查看各分区大小: [zyq@zyq ~]$ cat /proc/buddyinfo Node 0, zone DMA 0 2 3 2 3 1 0 0 1 1 3 Node 0, zone DMA32 218 77 38 26 13 5 2 2 2 2 539 Node 0, zone Normal 164 80 71 148 89 49 19 11 6 9 7043每一行代表当前的内存区中连续1、2、4、8、16、32、64、128、256、512、1024个可使用空闲页的数量,当前系统默认的页大小为4K,所以分别对应的大小为1x4k、2x4k、4x4k、8x4k、16x4k、32x4k、64x4k、128x4k、256x4k=1M、512x4k=2M、1024x4k=4M,由此可以计算出: DMA大小为: 3x4M+1x2M+1x1M+...=16M DMA32大小为: 539x4M+2*2M+2*1M+...=2G Normal大小为: 7043x4M+9x2M+6x1M+...=27G 查看当前系统可用内存 [zyq@zyq ~]$ free -h total used free shared buff/cache available Mem: 31G 697M 29G 108M 664M 29G Swap: 7.7G 0B 7.7G [zyq@zyq ~]$ cat /proc/meminfo MemTotal: 32520788 kB MemFree: 31126504 kB MemAvailable: 31270580 kB Buffers: 5400 kB Cached: 513132 kB SwapCached: 0 kB Active: 378812 kB ... [zyq@zyq ~]$ python Python 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 31126504/1024 30396 >>>由上图可发现系统当前可使用内存为30G与上述基本吻合。 通过dmesg日志查看DMA区域 [zyq@zyq ~]$ grep -i dma /var/log/dmesg -5 ... [ 0.000000] DMA [mem 0x00001000-0x00ffffff] [ 0.000000] DMA32 [mem 0x01000000-0xffffffff] [ 0.000000] Normal [mem 0x100000000-0x8527fffff] ... [ 0.000000] DMA zone: 64 pages used for memmap [ 0.000000] DMA zone: 71 pages reserved [ 0.000000] DMA zone: 3978 pages, LIFO batch:0 [ 0.000000] DMA32 zone: 10014 pages used for memmap [ 0.000000] DMA32 zone: 640850 pages, LIFO batch:31 [ 0.000000] Normal zone: 119968 pages used for memmap [ 0.000000] Normal zone: 7677952 pages, LIFO batch:31 ...从本日志也可以查询到相关信息,但是与/proc/buddyinfo的信息有出入,待进一步分析 |
CopyRight 2018-2019 实验室设备网 版权所有 |