VirtualBox

Ignore:
Timestamp:
Apr 14, 2015 3:46:47 PM (10 years ago)
Author:
vboxsync
Message:

memcache: alloc tuning.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/alloc/memcache.cpp

    r55253 r55256  
    350350DECL_FORCE_INLINE(int32_t) rtMemCacheGrabObj(PRTMEMCACHEPAGE pPage)
    351351{
    352     int32_t cFreeNew = ASMAtomicDecS32(&pPage->cFree);
    353     if (cFreeNew < 0)
    354     {
     352    if (ASMAtomicUoReadS32(&pPage->cFree) > 0)
     353    {
     354        int32_t cFreeNew = ASMAtomicDecS32(&pPage->cFree);
     355        if (cFreeNew >= 0)
     356            return cFreeNew;
    355357        ASMAtomicIncS32(&pPage->cFree);
    356         return -1;
    357     }
    358     return cFreeNew;
     358    }
     359    return -1;
    359360}
    360361
     
    414415     * Grab a free object at the page level.
    415416     */
    416     PRTMEMCACHEPAGE pPage = ASMAtomicReadPtrT(&pThis->pPageHint, PRTMEMCACHEPAGE);
     417    PRTMEMCACHEPAGE pPage = ASMAtomicUoReadPtrT(&pThis->pPageHint, PRTMEMCACHEPAGE);
    417418    int32_t iObj = pPage ? rtMemCacheGrabObj(pPage) : -1;
    418419    if (iObj < 0)
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