aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenpaging/xenpaging.h
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2012-02-20 21:18:44 +0100
committerOlaf Hering <olaf@aepfle.de>2012-02-20 21:18:44 +0100
commit9245411c958f4c4a1e77e76b2e1fde699a56929e (patch)
tree3abb796d4b0b4df153d48518f1edb2a410ef3be7 /tools/xenpaging/xenpaging.h
parent057d014a288437fef4d58379f1aabcc59a99ea57 (diff)
downloadxen-9245411c958f4c4a1e77e76b2e1fde699a56929e.tar.gz
xen-9245411c958f4c4a1e77e76b2e1fde699a56929e.tar.bz2
xen-9245411c958f4c4a1e77e76b2e1fde699a56929e.zip
xenpaging: use flat index for pagefile and page-in requests
This change is based on an idea by <hongkaixing@huawei.com> and <bicky.shi@huawei.com>. Scanning the victims[] array is time consuming with a large number of target pages. Replace the loop to find the slot in the pagefile which holds the requested gfn with an index. Remove the victims array and replace it with a flat array. This array holds the gfn for a given slot in the pagefile. Adjust all users of the victims array. Rename variable in main() from i to slot to clearify the meaning. Update xenpaging_evict_page() to pass a pointer to xen_pfn_t to xc_map_foreign_pages(). Update policy_choose_victim() to return either a gfn or INVALID_MFN. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/xenpaging/xenpaging.h')
-rw-r--r--tools/xenpaging/xenpaging.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/tools/xenpaging/xenpaging.h b/tools/xenpaging/xenpaging.h
index 160fc1d1c5..545f2d3626 100644
--- a/tools/xenpaging/xenpaging.h
+++ b/tools/xenpaging/xenpaging.h
@@ -46,6 +46,9 @@ struct xenpaging {
unsigned long *bitmap;
+ unsigned long *slot_to_gfn;
+ int *gfn_to_slot;
+
struct mem_event mem_event;
/* number of pages for which data structures were allocated */
int max_pages;
@@ -56,13 +59,6 @@ struct xenpaging {
unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
};
-
-struct victim {
- /* the gfn of the page to evict */
- unsigned long gfn;
-};
-
-
extern void create_page_in_thread(struct xenpaging *paging);
extern void page_in_trigger(void);