GMMR0Internal.h revision e64031e20c39650a7bc902a3e1aba613b9415dee
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync/* $Id$ */
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync/** @file
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync * GMM - The Global Memory Manager, Internal Header.
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync */
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync/*
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2007 Oracle Corporation
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync *
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync * available from http://www.virtualbox.org. This file is free software;
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync */
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync#ifndef ___GMMR0Internal_h
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync#define ___GMMR0Internal_h
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync#include <VBox/gmm.h>
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync
1dc25926f76c463686b66fb6adec583eef0717advboxsync/**
1dc25926f76c463686b66fb6adec583eef0717advboxsync * The allocation sizes.
1dc25926f76c463686b66fb6adec583eef0717advboxsync */
1dc25926f76c463686b66fb6adec583eef0717advboxsynctypedef struct GMMVMSIZES
1dc25926f76c463686b66fb6adec583eef0717advboxsync{
1dc25926f76c463686b66fb6adec583eef0717advboxsync /** The number of pages of base memory.
1dc25926f76c463686b66fb6adec583eef0717advboxsync * This is the sum of RAM, ROMs and handy pages. */
1dc25926f76c463686b66fb6adec583eef0717advboxsync uint64_t cBasePages;
1dc25926f76c463686b66fb6adec583eef0717advboxsync /** The number of pages for the shadow pool. (Can be sequeezed for memory.) */
1dc25926f76c463686b66fb6adec583eef0717advboxsync uint32_t cShadowPages;
1dc25926f76c463686b66fb6adec583eef0717advboxsync /** The number of pages for fixed allocations like MMIO2 and the hyper heap. */
1dc25926f76c463686b66fb6adec583eef0717advboxsync uint32_t cFixedPages;
1dc25926f76c463686b66fb6adec583eef0717advboxsync} GMMVMSIZES;
1dc25926f76c463686b66fb6adec583eef0717advboxsynctypedef GMMVMSIZES *PGMMVMSIZES;
1dc25926f76c463686b66fb6adec583eef0717advboxsync
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync/**
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync * The per-VM GMM data.
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync */
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsynctypedef struct GMMPERVM
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync{
1dc25926f76c463686b66fb6adec583eef0717advboxsync /** The reservations. */
1dc25926f76c463686b66fb6adec583eef0717advboxsync GMMVMSIZES Reserved;
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync /** The actual allocations.
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync * This includes both private and shared page allocations. */
1dc25926f76c463686b66fb6adec583eef0717advboxsync GMMVMSIZES Allocated;
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync
1dc25926f76c463686b66fb6adec583eef0717advboxsync /** The current number of private pages. */
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync uint64_t cPrivatePages;
1dc25926f76c463686b66fb6adec583eef0717advboxsync /** The current number of shared pages. */
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync uint64_t cSharedPages;
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync /** The current over-comitment policy. */
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync GMMOCPOLICY enmPolicy;
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync /** The VM priority for arbitrating VMs in low and out of memory situation.
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync * Like which VMs to start sequeezing first. */
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync GMMPRIORITY enmPriority;
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync
1dc25926f76c463686b66fb6adec583eef0717advboxsync /** The current number of ballooned pages. */
1dc25926f76c463686b66fb6adec583eef0717advboxsync uint64_t cBalloonedPages;
1dc25926f76c463686b66fb6adec583eef0717advboxsync /** The max number of pages that can be ballooned. */
1dc25926f76c463686b66fb6adec583eef0717advboxsync uint64_t cMaxBalloonedPages;
1d5596b941d86a014c20420b73ad7be2de35cf9dvboxsync /** The number of pages we've currently requested the guest to give us.
1d5596b941d86a014c20420b73ad7be2de35cf9dvboxsync * This is 0 if no pages currently requested. */
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync uint64_t cReqBalloonedPages;
1d5596b941d86a014c20420b73ad7be2de35cf9dvboxsync /** The number of pages the guest has given us in response to the request.
1d5596b941d86a014c20420b73ad7be2de35cf9dvboxsync * This is not reset on request completed and may be used in later decisions. */
1d5596b941d86a014c20420b73ad7be2de35cf9dvboxsync uint64_t cReqActuallyBalloonedPages;
1d5596b941d86a014c20420b73ad7be2de35cf9dvboxsync /** The number of pages we've currently requested the guest to take back. */
1d5596b941d86a014c20420b73ad7be2de35cf9dvboxsync uint64_t cReqDeflatePages;
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync /** Whether ballooning is enabled or not. */
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync bool fBallooningEnabled;
3cc114d9c84cf4a1e3b5225e81527614c30f1d83vboxsync
1dc25926f76c463686b66fb6adec583eef0717advboxsync /** Whether the VM is allowed to allocate memory or not.
1dc25926f76c463686b66fb6adec583eef0717advboxsync * This is used when the reservation update request fails or when the VM has
1dc25926f76c463686b66fb6adec583eef0717advboxsync * been told to suspend/save/die in an out-of-memory case. */
1dc25926f76c463686b66fb6adec583eef0717advboxsync bool fMayAllocate;
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync} GMMPERVM;
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync/** Pointer to the per-VM GMM data. */
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsynctypedef GMMPERVM *PGMMPERVM;
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync#endif
1205f5a22a14de7b9cf3055d6f914eac690c1715vboxsync