aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenpaging/policy_default.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix emacs local variable block to use correct C style variable.David Vrabel2013-02-211-1/+1
| | | | | | | The emacs variable to set the C style from a local variable block is c-file-style, not c-set-style. Signed-off-by: David Vrabel <david.vrabel@citrix.com
* xenpaging: improve performance in policy_choose_victimOlaf Hering2012-02-201-16/+41
| | | | | | | | | | | | | | policy_choose_victim() is one of the bottlenecks in xenpaging. It is called alot to find free bits in the fragmented bitmaps. Reduce turnaround time by skipping longs with all bits set. Adjust wrap detection in loop. v2: - fix copy&paste error, bitmap was tested twice Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: no poll timeout while page-out is in progressOlaf Hering2012-02-201-0/+1
| | | | | | | | | | | | | | | | | | | The main loop calls xenpaging_wait_for_event_or_timeout() unconditionally before doing any work. This function calls poll() with a timeout of 100ms. As a result the page-out process is very slow due to the delay in poll(). Call poll() without timeout so that it returns immediately until the page-out is done. Page-out is done when either the policy finds no more pages to nominate or when the requested number of pages is reached. The condition is cleared when a watch event arrives, so that processing the new target is not delayed once again by poll(). v2: - no poll timeout also when large number of evicts is pending Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: use flat index for pagefile and page-in requestsOlaf Hering2012-02-201-6/+3
| | | | | | | | | | | | | | | | | | | | | | | 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>
* xenpaging: convert xenpaging_t to struct xenpagingOlaf Hering2012-01-091-2/+2
| | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: convert xenpaging_victim_t to struct victimOlaf Hering2012-01-091-1/+1
| | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: improve policy mru list handlingOlaf Hering2011-11-201-3/+24
| | | | | | | | | | | | | | | | | | | Without this change it is not possible to page-out all guest pages, then trigger a page-in for all pages, and then page-out everything once again. All pages in the mru list can not be paged out because they remain active in the internal bitmap of paged pages. Use the mru list only if the number of paged-out pages is larger than the mru list. If the number is smaller, start to clear the mru list. In case the number of paged-out pages drops to zero the mru list and the internal bitmap will be empty as well. Also add a new interface for dropped pages. If a gfn was dropped there is no need to adjust the mru list because dropping a page is not usage of a page. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: use guests tot_pages as working targetOlaf Hering2011-11-201-1/+0
| | | | | | | | | This change reverses the task of xenpaging. Before this change a fixed number of pages was paged out. With this change the guest will not have access to more than the given number of pages at the same time. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: retry unpageable gfnsOlaf Hering2011-11-201-0/+14
| | | | | | | | | | | Nomination of gfns can fail, but may succeed later. Thats the case for a guest that starts ballooned. v2: - print debug when clearing uncosumed happens Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: remove xc_dominfo_t from paging_tOlaf Hering2011-11-201-4/+4
| | | | | | | | Remove xc_dominfo_t from paging_t, record only max_pages. This value is used to setup internal data structures. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: remove filename from commentOlaf Hering2011-11-201-1/+0
| | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: start paging in the middle of gfn rangeOlaf Hering2011-06-101-0/+4
| | | | | | | | Set the starting gfn to somewhere in the middle of the gfn range to avoid paging during BIOS startup. This can speedup booting of a guest. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: drop xc.c, remove ASSERTOlaf Hering2011-06-101-1/+0
| | | | | | | The ASSERT is not needed, victim is never NULL. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* tools: merge several bitop functions into xc_bitops.hOlaf Hering2011-06-101-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | Bitmaps are used in save/restore, xenpaging and blktap2. Merge the code into a private xc_bitops.h file. All users are single threaded, so locking is not an issue. The array of bits is handled as volatile because the x86 save/restore code passes the bitmap to the hypervisor which in turn modifies the bitmap. blktap2 uses a private bitmap. There was a possible overflow in the bitmap_size() function, the remainder was not considered. ia64 save/restore uses a bitmap to send the number of vcpus to the host. x86 save/restore uses a bitmap to track dirty pages. This bitmap is shared with the hypervisor. An unused function count_bits() was removed and a new bitmap_size() function is now used. xenpaging uses 3 private bitmaps to track the gfns which are in paged-out state. It had a copy of some Linux bitops.h, which is now obsolete. Also the BITS_PER_LONG macro was hardcoded to 64 which made it impossible to run 32bit tools on a 64bit host. Wether this works at all has to be tested, yet. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: specify policy mru_size at runtimeKeir Fraser2011-01-111-5/+18
| | | | | | | | | | The environment variable XENPAGING_POLICY_MRU_SIZE will change the mru_size in the policy at runtime. Specifying the mru_size at runtime allows the admin to keep more pages in memory so guests can make more progress. Its also good for development to reduce the value to put more pressure on the paging related code paths. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: remove domain_id and mfn from struct xenpaging_victimKeir Fraser2011-01-111-7/+3
| | | | | | | | | | | | Remove unused member 'mfn' from struct xenpaging_victim. xenpaging operates on a single guest, so it needs only a single domain_id. Remove domain_id from struct xenpaging_victim and use the one from paging->mem_event where needed. Its not used in the policy. This saves 4MB runtime data with a 1GB pagefile. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* libxc: convert evtchn interfaces to use an opaque handle typeIan Campbell2010-12-231-1/+1
| | | | | | | | | | | | This makes the interface consistent with the changes made to the main interface in 21483:779c0ef9682c. Also fix some references to "struct xc_interface" which should have been simply "xc_interface" in tools/xenpaging, and update QEMU_TAG to pull in the corresponding qemu change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: update xch usageOlaf Hering2010-12-141-2/+2
| | | | | | | | Instead of passing xch around, use the handle from xenpaging_t. In the updated functions, use a local xch variable. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: increase recently used pages from 4MB to 64MBKeir Fraser2010-11-261-1/+1
| | | | | | | | Increase recently used pages from 4MB to 64MB. Keeping more pages in memory allows the guest to make more progress if the paging file spans the entire guest memory. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: break endless loop during inital page-out with large pagefilesKeir Fraser2010-11-261-7/+28
| | | | | | | | | | | | | | | To allow the starting for xenpaging right after 'xm start XYZ', I specified a pagefile size equal to the guest memory size in the hope to catch more errors where the paged-out state of a p2mt is not checked. While doing that, xenpaging got into an endless loop because some pages cant be paged out right away. Now the policy reports an error if the gfn number wraps. Signed-off-by: Olaf Hering <olaf@aepfle.de> Already-Acked-by: Patrick Colp <pjcolp@cs.ubc.ca> Already-Acked-by: Keir Fraser <keir.fraser@citrix.com>
* libxc: eliminate static variables, use xentoollog; API changeKeir Fraser2010-05-281-1/+2
| | | | | | | | | | | | | | | | | | | | This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Make Citrix copyright strinsg consistent.Keir Fraser2009-12-181-1/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* User-land tool for memory paging.Keir Fraser2009-12-171-0/+103
This tool will page out the specified number of pages from the specified domain. When a paged out page is accessed, Xen will issue a request and notify the tool over an event channel. The tool will process ther request, page the page in, and notify Xen. The current (default) policy tracks the 1024 most recently paged in pages and will not choose to evict any of those. This is done with the assumption that if a page is accessed, it is likely to be accessed again soon. Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>