VirtualBox

Changeset 33008 in vbox for trunk


Ignore:
Timestamp:
Oct 8, 2010 12:25:52 PM (14 years ago)
Author:
vboxsync
Message:

Allocate more pgm pool pages for large guest memory configurations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PGMPool.cpp

    r32550 r33008  
    144144    PCFGMNODE pCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/PGM/Pool");
    145145
     146    /* Default pgm pool size equals 1024 pages. */
     147    uint16_t cMaxPages = 4*_1M >> PAGE_SHIFT;
     148
     149#if HC_ARCH_BITS == 64
     150    uint64_t cbRam = 0;
     151    CFGMR3QueryU64Def(CFGMR3GetRoot(pVM), "RamSize", &cbRam, 0);
     152
     153    /* We should increase the pgm pool size for guests with more than 2 GB of ram */
     154    if (cbRam >= UINT64_C(2) * _1G)
     155    {
     156        /* In the nested paging case we require 2 + 513 * (cbRam/1GB) pages to
     157         * store the entire page table descriptors.
     158         */
     159        uint64_t u64MaxPages = cbRam  / (_1G / UINT64_C(512));
     160        if (u64MaxPages > PGMPOOL_IDX_LAST)
     161            cMaxPages = PGMPOOL_IDX_LAST;
     162        else
     163            cMaxPages = (uint16_t)u64MaxPages;
     164    }
     165#endif
     166
    146167    /** @cfgm{/PGM/Pool/MaxPages, uint16_t, #pages, 16, 0x3fff, 1024}
    147168     * The max size of the shadow page pool in pages. The pool will grow dynamically
    148169     * up to this limit.
    149170     */
    150     uint16_t cMaxPages;
    151     int rc = CFGMR3QueryU16Def(pCfg, "MaxPages", &cMaxPages, 4*_1M >> PAGE_SHIFT);
     171    int rc = CFGMR3QueryU16Def(pCfg, "MaxPages", &cMaxPages, cMaxPages);
    152172    AssertLogRelRCReturn(rc, rc);
    153173    AssertLogRelMsgReturn(cMaxPages <= PGMPOOL_IDX_LAST && cMaxPages >= RT_ALIGN(PGMPOOL_IDX_FIRST, 16),
     
    186206    AssertLogRelRCReturn(rc, rc);
    187207
    188     Log(("pgmR3PoolInit: cMaxPages=%#RX16 cMaxUsers=%#RX16 cMaxPhysExts=%#RX16 fCacheEnable=%RTbool\n",
    189          cMaxPages, cMaxUsers, cMaxPhysExts, fCacheEnabled));
     208    LogRel(("pgmR3PoolInit: cMaxPages=%#RX16 cMaxUsers=%#RX16 cMaxPhysExts=%#RX16 fCacheEnable=%RTbool\n",
     209             cMaxPages, cMaxUsers, cMaxPhysExts, fCacheEnabled));
    190210
    191211    /*
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