2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2014, The V3VEE Project <http://www.v3vee.org>
11 * All rights reserved.
13 * Author: Daniel Zuo <pengzuo2014@u.northwestern.edu>
14 * Nikhat Karimi <nikhatkarimi@gmail.com>
15 * Ahalya Srinivasan <AhalyaSrinivasan2015@u.northwestern.edu>
16 * Peter Dinda <pdinda@northwestern.edu>
18 * This is free software. You are permitted to use,
19 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
23 #ifndef __VMM_SWAPPING_H
24 #define __VMM_SWAPPING_H
29 #include <palacios/vmm_types.h>
30 #include <palacios/vmm_lock.h>
31 #include <interfaces/vmm_file.h>
36 V3_SWAP_LRU, // this is not the droid you're looking for
37 } v3_swapping_strategy_t;
39 // for inclusion in the vm struct
40 struct v3_swap_impl_state {
41 // per-VM lock should be held when changing
42 // swap state or the swapping elements of base region state
44 uint32_t enable_swapping:1;
45 v3_swapping_strategy_t strategy;
46 uint64_t host_mem_size; // allocated space in bytes
48 uint64_t last_region_used; // for use by V3_SWAP_NEXT_FIT
49 // This is the swap file on disk
54 // for inclusion in the region
55 struct v3_swap_region_state {
56 uint64_t last_accessed; // timestamp
64 int v3_init_swapping();
65 int v3_deinit_swapping();
67 int v3_init_swapping_vm(struct v3_vm_info *vm, struct v3_xml *config);
68 int v3_deinit_swapping_vm(struct v3_vm_info *vm);
71 //int v3_init_swapping_core(struct guest_info *core);
72 //int v3_deinit_swapping_core(struct guest_info *core);
74 int v3_pin_region(struct v3_vm_info *vm, struct v3_mem_region *region);
75 int v3_unpin_region(struct v3_vm_info *vm, struct v3_mem_region *region);
77 // This will automatically swap out a victim if needed
78 int v3_swap_in_region(struct v3_vm_info *vm, struct v3_mem_region *region);
80 int v3_swap_out_region(struct v3_vm_info *vm, struct v3_mem_region *region);
83 void v3_touch_region(struct v3_vm_info *vm, struct v3_mem_region *region);
85 #endif /* ! __V3VEE__ */