VirtualBox

Changeset 27116 in vbox for trunk


Ignore:
Timestamp:
Mar 5, 2010 5:16:36 PM (15 years ago)
Author:
vboxsync
Message:

Kicked out the GMMR0DeflatedBalloon implementation since it was replaced by GMMR0BalloonedPages earlier today.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/gmm.h

    r27102 r27116  
    185185} GMMACCOUNT;
    186186
    187 /**
    188  * Balloon action enum.
     187
     188/**
     189 * Balloon actions.
    189190 */
    190191typedef enum
    191192{
     193    /** Invalid zero entry. */
    192194    GMMBALLOONACTION_INVALID = 0,
    193     GMMBALLOONACTION_INFLATE = 1,
    194     GMMBALLOONACTION_DEFLATE = 2,
    195     GMMBALLOONACTION_RESET   = 3,
     195    /** Inflate the balloon. */
     196    GMMBALLOONACTION_INFLATE,
     197    /** Deflate the balloon. */
     198    GMMBALLOONACTION_DEFLATE,
     199    /** Puncture the balloon because of VM reset. */
     200    GMMBALLOONACTION_RESET,
     201    /** End of the valid actions. */
     202    GMMBALLOONACTION_END,
    196203    /** hack forcing the size of the enum to 32-bits. */
    197204    GMMBALLOONACTION_MAKE_32BIT_HACK = 0x7fffffff
    198205} GMMBALLOONACTION;
     206
    199207
    200208/**
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r27103 r27116  
    28422842 *
    28432843 * @returns VBox status code:
    2844  * @retval  xxx
     2844 * @retval  VERR_GMM_ATTEMPT_TO_FREE_TOO_MUCH
     2845 * @retval  VERR_GMM_ATTEMPT_TO_DEFLATE_TOO_MUCH
     2846 * @retval  VERR_GMM_OVERCOMMITED_TRY_AGAIN_IN_A_BIT - reset condition
     2847 *          indicating that we won't neceessarily have sufficient RAM to boot
     2848 *          the VM again and that it should pause until this changes (we'll try
     2849 *          balloon some other VM).  (For standard deflate we have little choice
     2850 *          but to hope the VM won't use the memory that was returned to it.)
    28452851 *
    28462852 * @param   pVM                 Pointer to the shared VM structure.
     
    29182924                    pGMM->cBalloonedPages       -= cBalloonedPages;
    29192925                    pGVM->gmm.s.cBalloonedPages -= cBalloonedPages;
    2920                     Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx (user)\n",
    2921                          cBalloonedPages, pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages));
     2926                    if (pGVM->gmm.s.cReqDeflatePages)
     2927                    {
     2928                        AssertFailed(); /* This is path is for later. */
     2929                        Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx Req=%#llx\n", cPages,
     2930                             pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages, pGVM->gmm.s.cReqDeflatePages));
     2931
     2932                        /*
     2933                         * Anything we need to do here now when the request has been completed?
     2934                         */
     2935                        pGVM->gmm.s.cReqDeflatePages = 0;
     2936                    }
     2937                    else
     2938                        Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx (user)\n", cPages,
     2939                             pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages));
    29222940                }
    29232941                else
     
    29712989
    29722990    return GMMR0BalloonedPages(pVM, idCpu, pReq->enmAction, pReq->cBalloonedPages);
    2973 }
    2974 
    2975 
    2976 /**
    2977  * Report balloon deflating.
    2978  *
    2979  * @returns VBox status code:
    2980  * @retval  xxx
    2981  *
    2982  * @param   pVM                 Pointer to the shared VM structure.
    2983  * @param   idCpu               VCPU id
    2984  * @param   cPages              The number of pages that was let out of the balloon.
    2985  * @thread  EMT.
    2986  */
    2987 GMMR0DECL(int) GMMR0DeflatedBalloon(PVM pVM, VMCPUID idCpu, uint32_t cPages)
    2988 {
    2989     LogFlow(("GMMR0DeflatedBalloon: pVM=%p cPages=%#x\n", pVM, cPages));
    2990 
    2991     /*
    2992      * Validate input and get the basics.
    2993      */
    2994     PGMM pGMM;
    2995     GMM_GET_VALID_INSTANCE(pGMM, VERR_INTERNAL_ERROR);
    2996     PGVM pGVM;
    2997     int rc = GVMMR0ByVMAndEMT(pVM, idCpu, &pGVM);
    2998     if (RT_FAILURE(rc))
    2999         return rc;
    3000 
    3001     AssertMsgReturn(cPages < RT_BIT(32 - PAGE_SHIFT), ("%#x\n", cPages), VERR_INVALID_PARAMETER);
    3002 
    3003     /*
    3004      * Take the sempahore and do some more validations.
    3005      */
    3006     rc = RTSemFastMutexRequest(pGMM->Mtx);
    3007     AssertRC(rc);
    3008     if (GMM_CHECK_SANITY_UPON_ENTERING(pGMM))
    3009     {
    3010 
    3011         if (pGVM->gmm.s.cBalloonedPages < cPages)
    3012         {
    3013             Assert(pGMM->cBalloonedPages >= pGVM->gmm.s.cBalloonedPages);
    3014 
    3015             /*
    3016              * Record it.
    3017              */
    3018             pGMM->cBalloonedPages -= cPages;
    3019             pGVM->gmm.s.cBalloonedPages -= cPages;
    3020             if (pGVM->gmm.s.cReqDeflatePages)
    3021             {
    3022                 Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx Req=%#llx\n", cPages,
    3023                      pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages, pGVM->gmm.s.cReqDeflatePages));
    3024 
    3025                 /*
    3026                  * Anything we need to do here now when the request has been completed?
    3027                  */
    3028                 pGVM->gmm.s.cReqDeflatePages = 0;
    3029             }
    3030             else
    3031                 Log(("GMMR0BalloonedPages: -%#x - Global=%#llx / VM: Total=%#llx\n", cPages,
    3032                      pGMM->cBalloonedPages, pGVM->gmm.s.cBalloonedPages));
    3033         }
    3034         else
    3035         {
    3036             Log(("GMMR0DeflatedBalloon: cBalloonedPages=%#llx cPages=%#x\n", pGVM->gmm.s.cBalloonedPages, cPages));
    3037             rc = VERR_GMM_ATTEMPT_TO_DEFLATE_TOO_MUCH;
    3038         }
    3039 
    3040         GMM_CHECK_SANITY_UPON_LEAVING(pGMM);
    3041     }
    3042     else
    3043         rc = VERR_INTERNAL_ERROR_5;
    3044     RTSemFastMutexRelease(pGMM->Mtx);
    3045     LogFlow(("GMMR0BalloonedPages: returns %Rrc\n", rc));
    3046     return rc;
    30472991}
    30482992
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette