|
struct page的几个与队列指针:
struct list_head list;
struct address_space *mapping;
struct page *next_hash;
struct page **pprev_hash
struct list_head lru;
各有什么用?他们根据page的状态各自挂入哪个队列?
内核2.4.0vmscan.c的代码中:
int refill_inactive_scan(unsigned int priority, int oneshot)
{
struct list_head * page_lru;
struct page * page;
int maxscan, page_active = 0;
int ret = 0;
/* Take the lock while messing with the list... */
spin_lock(&pagemap_lru_lock);
maxscan = nr_active_pages >> priority;
while (maxscan-- > 0 && (page_lru = active_list.prev) != &active_list) {
page = list_entry(page_lru, struct page, lru);
/* Wrong page on list?! (list corruption, should not happen) */
if (!PageActive(page)) {
printk("VM: refill_inactive, wrong page on list.\n");
list_del(page_lru); //将page从活动队列中删除
nr_active_pages--; //活动页面数--
continue;
}
在最后这个if结构中将page结构从活动队列中删除了,但是既没有挂入脏队列,也没有挂入到干净队列,也没有放入空闲区中。这样一个这一个页面对应的内存在内核范围内不就永远的丢失了么?
拜谢 |
|