关于mm_struct结构体
字段atomic_t mm_count;在LKD3有下面的一句话:
When the kernel operates on an address space and needs to
bump its associated reference count, the kernel increments mm_count. Having two counters
enables the kernel to differentiate between the main usage counter (mm_count) and
the number of processes using the address space (mm_users).
究竟什么时候增长mm_count?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
We'll try to explain the difference between the use of mm_users and mm_count with an example. Consider a memory descriptor shared by two lightweight processes. Normally, its mm_users field stores the value 2, while its mm_count field stores the value 1 (both owner processes count as one).
If the memory descriptor is temporarily lent to a kernel thread (see the next section), the kernel increases the mm_count field. In this way, even if both lightweight processes die and the mm_users field becomes zero, the memory descriptor is not released until the kernel thread finishes using it because the mm_count field remains greater than zero.
http://bbs.chinaunix.net/thread-1991118-1-1.html
tks,内核线程用的是前一个进程的地址空间
准确的说,所有的内核例程都在一个空间里面。