VirtualBox

Ignore:
Timestamp:
Jun 24, 2009 6:05:15 PM (15 years ago)
Author:
vboxsync
Message:

GMMR0.cpp: The proper fix for the wrong cFreePages accounting.

File:
1 edited

Legend:

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

    r20899 r20900  
    923923        unsigned cFree = 0;
    924924
     925        gmmR0UnlinkChunk(pChunk);       /* avoiding cFreePages updates. */
     926
    925927        uint16_t hGVM = pGVM->hSelf;
    926928        unsigned iPage = (GMM_CHUNK_SIZE >> PAGE_SHIFT);
     
    935937                     * The reason for not using gmmR0FreePrivatePage here is that we
    936938                     * must *not* cause the chunk to be freed from under us - we're in
    937                      * a AVL tree walk here.
     939                     * an AVL tree walk here.
    938940                     */
    939941                    pChunk->aPages[iPage].u = 0;
     
    942944                    pChunk->iFreeHead = iPage;
    943945                    pChunk->cPrivate--;
    944                     if ((pChunk->cFree & GMM_CHUNK_FREE_SET_MASK) == 0)
    945                     {
    946                         gmmR0UnlinkChunk(pChunk);
    947                         pChunk->cFree++;
    948                         gmmR0LinkChunk(pChunk, pChunk->cShared ? &g_pGMM->Shared : &g_pGMM->Private);
    949                     }
    950                     else
    951                         pChunk->cFree++;
     946                    pChunk->cFree++;
    952947                    pGVM->gmm.s.cPrivatePages--;
    953948                    cFree++;
     
    960955            else
    961956                cShared++;
     957
     958        gmmR0LinkChunk(pChunk, pChunk->cShared ? &g_pGMM->Shared : &g_pGMM->Private);
    962959
    963960        /*
     
    18271824     */
    18281825    PGMMCHUNKFREESET pSet = &pGMM->Private;
    1829 #if 0 /** @todo this is broken, at least on windows... */
    18301826    if (pSet->cFreePages < cPages)
    18311827        return VERR_GMM_SEED_ME;
    1832 #endif
    18331828    if (pGMM->fBoundMemoryMode)
    18341829    {
     
    18461841            return VERR_GMM_SEED_ME;
    18471842    }
    1848     else if (pSet->cFreePages < cPages) /* see #if 0 */
    1849         return VERR_GMM_SEED_ME;
    18501843
    18511844    /*
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