[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] xenpaing: one way to avoid paging out the page, when the corresponding mfn is in use.
Hello, Recently many advanced memory mechanisms are introduced into Xen. One problem we found is the conflict between p2m query and setting. For example, backend drivers always map domU’s page to its own space, during the mapping procedure, situations as follow may happen, when mfn is obtained by gfn_to_mfn(), this mfn is likely to be paged out. first case: grant mapping xenpaing mfn = gfn_to_mfn(); <----------- p2m_paging_nominate() | | Check type ok paged out; | try to map What we want is: When the page (mfn) is accessed by gfn_to_mfn(), this page should never be paged out until the mapping action is end. second case: grant mapping xenpaing p2m_paging_nominate() gfn_to_mfn(); mfn = gfn_to_mfn(); -------------> | check type ok | | Check type ok paged out; | try to map What we want is: When the gfn_to_mfn() action happens during paging nomination, the nomination should abort immediately. Our solution prototype is like this : 1. Introduce a new member named last_access in page_info struct to save the last access time and access tag. 2. when the mfn is obtained through gfn_to_mfn(), we save time stamp and access tag in the page_info. 3. Paging nominate procedure use access information as a criterion. How it works? 1.Using time stamp to avoid case 1. When the mfn is obtained by mapping process, the time stamp can prevent the page from being selected by paging . 2.Using access tag to avoid case 2. During the paging nomination, if the access tag of page is detected, paging should skip selecting this page. The pseudo-code of step 3 can be written as follow: int p2m_mem_paging_nominate(struct domain *d, unsigned long gfn) { mfn = gfn_to_mfn_noreference(d, gfn, &p2mt); -----> avoid saving timestamp and access tag if ( !mfn_valid(mfn) ) goto out; clear_access_tag(); ----------> clear the access tag of this page if (test_page_hot()) goto out; ------> if the page is accessed recently, go to out ........ set_p2m_entry(d, gfn, mfn, 0, p2m_ram_paging_out); if ( test_access_tag ( mfn ) ) goto out; --------> if access tag is set, the gfn_to_mfn must have happened above, abort anyway. ret = 0; out: p2m_unlock(d->arch.p2m); return ret; } Maybe this is an imperfect prototype, do you have any good ideas? Hong Kaixing _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |