VirtualBox

Changeset 29546 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
May 17, 2010 2:05:42 PM (15 years ago)
Author:
vboxsync
Message:

Fixed accounting for shared pages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r29510 r29546  
    18231823    {
    18241824        case GMMACCOUNT_BASE:
    1825             if (RT_UNLIKELY(pGVM->gmm.s.Allocated.cBasePages + pGVM->gmm.s.cBalloonedPages + cPages > pGVM->gmm.s.Reserved.cBasePages))
     1825            if (RT_UNLIKELY(pGVM->gmm.s.Allocated.cBasePages + pGVM->gmm.s.cBalloonedPages + pGVM->gmm.s.cSharedPages + cPages > pGVM->gmm.s.Reserved.cBasePages))
    18261826            {
    18271827                Log(("gmmR0AllocatePages:Base: Reserved=%#llx Allocated+Ballooned+Requested=%#llx+%#llx+%#x!\n",
     
    27112711    {
    27122712        case GMMACCOUNT_BASE:
    2713             if (RT_UNLIKELY(pGVM->gmm.s.Allocated.cBasePages < cPages))
     2713            if (RT_UNLIKELY(pGVM->gmm.s.Allocated.cBasePages + pGVM->gmm.s.cSharedPages < cPages))
    27142714            {
    27152715                Log(("gmmR0FreePages: allocated=%#llx cPages=%#x!\n", pGVM->gmm.s.Allocated.cBasePages, cPages));
     
    27432743    int rc = VINF_SUCCESS;
    27442744    uint32_t iPage;
     2745    uint32_t cSharedPages = 0;
    27452746    for (iPage = 0; iPage < cPages; iPage++)
    27462747    {
     
    27692770                Assert(pGVM->gmm.s.cSharedPages);
    27702771                pGVM->gmm.s.cSharedPages--;
     2772                cSharedPages++;
    27712773                Assert(pPage->Shared.cRefs);
    27722774                if (!--pPage->Shared.cRefs)
     
    27892791    }
    27902792
     2793    Assert(iPage > cSharedPages);
     2794
    27912795    /*
    27922796     * Update the account.
     
    27942798    switch (enmAccount)
    27952799    {
    2796         case GMMACCOUNT_BASE:   pGVM->gmm.s.Allocated.cBasePages   -= iPage; break;
     2800        case GMMACCOUNT_BASE:   pGVM->gmm.s.Allocated.cBasePages   -= (iPage - cSharedPages); break;
    27972801        case GMMACCOUNT_SHADOW: pGVM->gmm.s.Allocated.cShadowPages -= iPage; break;
    27982802        case GMMACCOUNT_FIXED:  pGVM->gmm.s.Allocated.cFixedPages  -= iPage; break;
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