在内核区域内获取页面

时间:2019-07-20 08:05:41

标签: linux-kernel kernel system-calls

我正在尝试查找内核中所有内存区域中引用的活动和非活动页面的数量,但是由于某种原因,尝试时我总是得到一个空列表。这是我到目前为止的内容:

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)重复一遍,我总是得到列表都是空的,我也不知道为什么。

0 个答案:

没有答案