VirtualBox

Changeset 31838 in vbox for trunk


Ignore:
Timestamp:
Aug 21, 2010 1:19:56 AM (14 years ago)
Author:
vboxsync
Message:

PGMRZDynMap.cpp: better high load check in PGMRZDynMapPushAutoSubset and PGMRZDynMapFlushAutoSet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMRZ/PGMRZDynMap.cpp

    r31834 r31838  
    254254    uint32_t                    cLoad;
    255255    /** The max load ever.
    256      * This is maintained to get trigger adding of more mapping space. */
     256     * This is maintained to trigger the adding of more mapping space. */
    257257    uint32_t                    cMaxLoad;
    258258# ifndef IN_RC
     
    18651865
    18661866/**
     1867 * Checks if the set has high load.
     1868 *
     1869 * @returns true on high load, otherwise false.
     1870 * @param   pSet            The set.
     1871 */
     1872DECLINLINE(bool) pgmRZDynMapHasHighLoad(PPGMMAPSET pSet)
     1873{
     1874#ifdef IN_RC
     1875    if (pSet->cEntries < MM_HYPER_DYNAMIC_SIZE / PAGE_SIZE / 2)
     1876        return false;
     1877#endif
     1878
     1879    PPGMRZDYNMAP pThis = PGMRZDYNMAP_SET_2_DYNMAP(pSet);
     1880    uint32_t cUnusedPages = pThis->cPages - pThis->cLoad;
     1881#ifdef IN_RC
     1882    return cUnusedPages <= MM_HYPER_DYNAMIC_SIZE / PAGE_SIZE * 36 / 100;
     1883#else
     1884    return cUnusedPages <= PGMR0DYNMAP_PAGES_PER_CPU_MIN;
     1885#endif
     1886}
     1887
     1888
     1889/**
    18671890 * Worker that performs the actual flushing of the set.
    18681891 *
     
    19551978#endif
    19561979        STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->aStatRZDynMapSetFilledPct[(cEntries * 10 / RT_ELEMENTS(pSet->aEntries)) % 11]);
    1957     if (cEntries >= RT_ELEMENTS(pSet->aEntries) * 45 / 100)
     1980    if (   cEntries >= RT_ELEMENTS(pSet->aEntries) * 45 / 100
     1981        || pgmRZDynMapHasHighLoad(pSet))
    19581982    {
    19591983        pSet->cEntries = 0;
     
    20882112     */
    20892113    if (   pSet->cEntries > RT_ELEMENTS(pSet->aEntries) * 60 / 100
    2090 #ifdef IN_RC
    2091         || pSet->cEntries > MM_HYPER_DYNAMIC_SIZE / PAGE_SIZE / 2  /** @todo need to do this for r0 as well.*/
    2092 #endif
    2093         )
     2114        || pgmRZDynMapHasHighLoad(pSet))
    20942115    {
    20952116        STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZDynMapSetOptimize);
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