1 | /* $Id: GMMR0Internal.h 8155 2008-04-18 15:16:47Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * GMM - The Global Memory Manager, Internal Header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ___GMMR0Internal_h
|
---|
23 | #define ___GMMR0Internal_h
|
---|
24 |
|
---|
25 | #include <VBox/gmm.h>
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The allocation sizes.
|
---|
29 | */
|
---|
30 | typedef struct GMMVMSIZES
|
---|
31 | {
|
---|
32 | /** The number of pages of base memory.
|
---|
33 | * This is the sum of RAM, ROMs and handy pages. */
|
---|
34 | uint64_t cBasePages;
|
---|
35 | /** The number of pages for the shadow pool. (Can be sequeezed for memory.) */
|
---|
36 | uint32_t cShadowPages;
|
---|
37 | /** The number of pages for fixed allocations like MMIO2 and the hyper heap. */
|
---|
38 | uint32_t cFixedPages;
|
---|
39 | } GMMVMSIZES;
|
---|
40 | typedef GMMVMSIZES *PGMMVMSIZES;
|
---|
41 |
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * The per-VM GMM data.
|
---|
45 | */
|
---|
46 | typedef struct GMMPERVM
|
---|
47 | {
|
---|
48 | /** The reservations. */
|
---|
49 | GMMVMSIZES Reserved;
|
---|
50 | /** The actual allocations.
|
---|
51 | * This includes both private and shared page allocations. */
|
---|
52 | GMMVMSIZES Allocated;
|
---|
53 |
|
---|
54 | /** The current number of private pages. */
|
---|
55 | uint64_t cPrivatePages;
|
---|
56 | /** The current number of shared pages. */
|
---|
57 | uint64_t cSharedPages;
|
---|
58 | /** The current over-comitment policy. */
|
---|
59 | GMMOCPOLICY enmPolicy;
|
---|
60 | /** The VM priority for arbitrating VMs in low and out of memory situation.
|
---|
61 | * Like which VMs to start sequeezing first. */
|
---|
62 | GMMPRIORITY enmPriority;
|
---|
63 |
|
---|
64 | /** The current number of ballooned pages. */
|
---|
65 | uint64_t cBalloonedPages;
|
---|
66 | /** The max number of pages that can be ballooned. */
|
---|
67 | uint64_t cMaxBalloonedPages;
|
---|
68 | /** The number of pages we've currently requested the guest to give us.
|
---|
69 | * This is 0 if no pages currently requested. */
|
---|
70 | uint64_t cReqBalloonedPages;
|
---|
71 | /** The number of pages the guest has given us in response to the request.
|
---|
72 | * This is not reset on request completed and may be used in later decisions. */
|
---|
73 | uint64_t cReqActuallyBalloonedPages;
|
---|
74 | /** The number of pages we've currently requested the guest to take back. */
|
---|
75 | uint64_t cReqDeflatePages;
|
---|
76 | /** Whether ballooning is enabled or not. */
|
---|
77 | bool fBallooningEnabled;
|
---|
78 |
|
---|
79 | /** Whether the VM is allowed to allocate memory or not.
|
---|
80 | * This is used when the reservation update request fails or when the VM has
|
---|
81 | * been told to suspend/save/die in an out-of-memory case. */
|
---|
82 | bool fMayAllocate;
|
---|
83 | } GMMPERVM;
|
---|
84 | /** Pointer to the per-VM GMM data. */
|
---|
85 | typedef GMMPERVM *PGMMPERVM;
|
---|
86 |
|
---|
87 | #endif
|
---|
88 |
|
---|