- 论坛徽章:
- 0
|
回复 1# fiddle
问得好。第一个问题没有看过。试着回答后面几个问题:
2. 再说说Android 4.0这部手机, /proc/zoneinfo的信息显示有两个zone:Normal以及HighMem。首先HighMem这个zone很令人费解,对于物理内存只有512MB的系统而言,怎么会有HighMem呢?通过查看代码,发现原来CONFIG_HIGHMEM这个选项在方案提供商提供的config文件中原本就是打开的,那么对于只有512MB物理内存的系统而言,是否需要关闭这个选项呢?
另外,即使是打开了CONFIG_HIGHMEM,从zoneinfo中看到,HighMem这个内存域的start_pfn是135680,按照4k页帧,HighMem内存域将从物理内存530M处开始。这也超出了物理内存的范围了。这又是怎么回事呢?(关于这个问题,可能和第三个问题有关)。
关于HIGHMEM,在Kernel是这样解释的:
HIGHMEM
bool "High Memory Support"
depends on MMU
help
The address space of ARM processors is only 4 Gigabytes large
and it has to accommodate user address space, kernel address
space as well as some memory mapped IO. That means that, if you
have a large amount of physical memory and/or IO, not all of the
memory can be "permanently mapped" by the kernel. The physical
memory that is not permanently mapped is called "high memory".
Depending on the selected kernel/user memory split, minimum
vmalloc space and actual amount of RAM, you may not need this
option which should result in a slightly faster kernel.
3. 对于嵌入式系统而言,物理内存地址经常是不连续的。以Android 2.3的这台手机为例,512MB的物理内存分在两个die中,内存物理地址分别映射在0x0000 0000~0x1000 0000以及0x4000 0000~0x5000 0000区间内。对于这种类型的内存分布模型,内核初始化内存域时是如何分配页帧号的呢?比如0x4000 0000这个地址开始的4k页帧,其pfn是直接接着前面物理内存编号,还是直接除以4k来编号呢?
页帧号=物理地址<<12
/*
* Convert a physical address to a Page Frame Number and back
*/
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
4. 如何知道一个zone中有多少物理内存?其范围是从哪到哪?
这个要根据kernel 最终拿到的cmdline中"mem"参数来决定物理内存有多大。
新手上路,如果是很白痴的问题,各位莫笑。 |
|