VirtualBox

Changeset 33537 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 28, 2010 8:49:11 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67137
Message:

Apply timeout to 2 MB page allocation

File:
1 edited

Legend:

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

    r33508 r33537  
    38463846{
    38473847#ifdef PGM_WITH_LARGE_PAGES
    3848     uint64_t cbAvailableMem;
    3849 
    3850     if (    RTSystemQueryAvailableRam(&cbAvailableMem) == VINF_SUCCESS
    3851         &&  cbAvailableMem < (UINT64_C(2) * _1G))
    3852     {
    3853         /** Too little free RAM left; don't bother as the host might try to move memory around, which is very expensive. */
    3854         LogRel(("PGMR3PhysAllocateLargeHandyPage: refuse to allocate large page; available memory on the host: %RX64\n", cbAvailableMem));
    3855         return VINF_EM_NO_MEMORY;
    3856     }
     3848    uint64_t u64TimeStamp1, u64TimeStamp2;
    38573849
    38583850    pgmLock(pVM);
    38593851
    38603852    STAM_PROFILE_START(&pVM->pgm.s.CTX_SUFF(pStats)->StatAllocLargePage, a);
     3853    u64TimeStamp1 = RTTimeMilliTS();
    38613854    int rc = VMMR3CallR0(pVM, VMMR0_DO_PGM_ALLOCATE_LARGE_HANDY_PAGE, 0, NULL);
     3855    u64TimeStamp2 = RTTimeMilliTS();
    38623856    STAM_PROFILE_STOP(&pVM->pgm.s.CTX_SUFF(pStats)->StatAllocLargePage, a);
    38633857    if (RT_SUCCESS(rc))
     
    39263920        }
    39273921        pVM->pgm.s.cLargeHandyPages = 0;
     3922    }
     3923
     3924    if (RT_SUCCESS(rc))
     3925    {
     3926        static uint32_t cTimeOut = 0;
     3927
     3928        if (u64TimeStamp2 - u64TimeStamp1 > 100)
     3929        {
     3930            if (++cTimeOut > 5)
     3931            {
     3932                /* If repeated attempts to allocate a large page takes more than 100 ms, then we fall back to normal 4k pages.
     3933                 * E.g. Vista 64 tries to move memory around, which takes a huge amount of time.
     3934                 */
     3935                LogRel(("PGMR3PhysAllocateLargePage: allocating large pages takes too long (last attempt %d ms); DISABLE\n", u64TimeStamp2 - u64TimeStamp1));
     3936                PGMSetLargePageUsage(pVM, false);
     3937            }
     3938        }
     3939        else
     3940        if (cTimeOut > 0)
     3941            cTimeOut--;
    39283942    }
    39293943
Note: See TracChangeset for help on using the changeset viewer.

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