我正在尝试查找内核中所有内存区域中引用的活动和非活动页面的数量,但是由于某种原因,尝试时我总是得到一个空列表。这是我到目前为止的内容:
for_each_zone(zonePtr) {
struct list_head *ptr;
struct list_head *lru_active_anon;
struct lruvec *lruvec = &(zonePtr->lruvec);
spin_lock_irq(&zonePtr->lru_lock);
lru_active_anon = &lruvec->lists[LRU_ACTIVE_ANON];
list_for_each(ptr, lru_active_anon) {
struct page *page;
page = lru_to_page(ptr);
if (page_referenced(page, 0, NULL, &vm_flags))
count++;
}
}
我对每个LRU列表(LRU_ACTIVE_ANON, LRU_ACTIVE_FILE, LRU_INACTIVE_ANON, LRU_INACTIVE_FILE
)重复一遍,我总是得到列表都是空的,我也不知道为什么。