亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標題: anon page到inactive lru之后還能回active lru嗎?page_check_references()問題。 [打印本頁]

作者: blake326    時間: 2015-10-21 10:28
標題: anon page到inactive lru之后還能回active lru嗎?page_check_references()問題。
畫了一個anon page life的狀態(tài)圖。

發(fā)現(xiàn)點疑問,當page到inactive lru時,此時應(yīng)用再訪問它的話,則會缺頁異常激活young pte, 考慮現(xiàn)在只有一個young pte的話,page_check_references代碼看起來只會keep在inactive lru中。不知道是否分析正確?

static enum page_references page_check_references(struct page *page,
                                                  struct scan_control *sc)
{
        int referenced_ptes, referenced_page;
        unsigned long vm_flags;

        referenced_ptes = page_referenced(page, 1, sc->target_mem_cgroup,
                                          &vm_flags);
        referenced_page = TestClearPageReferenced(page);

        /*
         * Mlock lost the isolation race with us.  Let try_to_unmap()
         * move the page to the unevictable list.
         */
        if (vm_flags & VM_LOCKED)
                return PAGEREF_RECLAIM;

        if (referenced_ptes) {
                if (PageSwapBacked(page))
                        return PAGEREF_ACTIVATE;
                /*
                 * All mapped pages start out with page table
                 * references from the instantiating fault, so we need
                 * to look twice if a mapped file page is used more
                 * than once.
                 *
                 * Mark it and spare it for another trip around the
                 * inactive list.  Another page table reference will
                 * lead to its activation.
                 *
                 * Note: the mark is set for activated pages as well
                 * so that recently deactivated but used pages are
                 * quickly recovered.
                 */
                SetPageReferenced(page);

                if (referenced_page || referenced_ptes > 1)
                        return PAGEREF_ACTIVATE;

                /*
                 * Activate file-backed executable pages after first usage.
                 */
                if (vm_flags & VM_EXEC)
                        return PAGEREF_ACTIVATE;

                return PAGEREF_KEEP;
        }

        /* Reclaim if clean, defer dirty pages to writeback */
        if (referenced_page && !PageSwapBacked(page))
                return PAGEREF_RECLAIM_CLEAN;

        return PAGEREF_RECLAIM;
}



作者: blake326    時間: 2015-10-21 10:56
                SetPageReferenced(page);

                if (referenced_page || referenced_ptes > 1)
                        return PAGEREF_ACTIVATE;

判斷referenced_ptes > 1還有一個refrence_page條件。那么看起來流程是這樣的:

1. new page, active anon lru
2. shrink_active_list, (old lpte, no hw pte), inactive anon lru
3. 用戶訪問缺頁異常。 (young lpte, hw pte), inactive anon lru
4. shrink_inactive_list, keep inactive anon lru (set page referenced)(old lpte, no hw pte)
5. 用戶訪問缺頁異常。(young lpte, hw pte), inactive anon lru, page referenced
6. shrink_inactive_list, because page referenced and young pte,  回active anon lru

不知理解是否正確。




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2