[英]Understand BINDER_VM_SIZE in Android source code
In file framework/native/libs/binder/ProcessState.cpp
在文件framework/native/libs/binder/ProcessState.cpp
Why is BINDER_VM_SIZE
set to 1M-8k? 为什么将BINDER_VM_SIZE
设置为1M-8k?
#define BINDER_VM_SIZE ((1*1024*1024) - (4096 *2))
It's not this value initially, you can find that(from git commit log) it's first value is 最初不是这个值,您可以从git commit log中找到它的第一个值是
#define BINDER_VM_SIZE (1*1024*1024)
Then someone change this value to 然后有人将此值更改为
#define BINDER_VM_SIZE ((1*1024*1024) - (4096 *2))
with the following commit message: 带有以下提交消息:
Modify the binder to request 1M - 2 pages instead of 1M. 修改活页夹,以请求1M-2页而不是1M。 The backing store in the kernel requires a guard page, so 1M allocations fragment memory very badly. 内核中的后备存储需要一个保护页,因此1M分配碎片内存非常糟糕。 Subtracting a couple of pages so that they fit in a power of two allows the kernel to make more efficient use of its virtual address space. 减去几个页面,使其适合于2的幂,则内核可以更有效地利用其虚拟地址空间。
I myself don't fully understand this message,so I just paste it here hope it may help your understanding! 我本人并不完全理解此消息,因此我仅将其粘贴到此处,希望对您有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.