修改count情景
- cache mapping (page->mapping)
- private data (page->private)
- page mapped in task’s page tables, each mapping is counted.
count值的含义
page ->_count = -1:代表空闲页
page->_count = 0:代表1个引用
函数接口
297 #define put_page_testzero(p) \
298 ({ \
299 BUG_ON(page_count(p) == 0); \
300 atomic_add_negative(-1, &(p)->_count); \
301 })
减少1个引用,如果引用的值小于0(也就是_count小于-1),则返回true。
define get_page_testone(p) atomic_inc_and_test(&(p)->_count)
增加一个引用,如果之前的逻辑引用值为0(_count等于-1),则返回为true。增加引用,并且判断之前page是空闲的。
1051

被折叠的 条评论
为什么被折叠?



