VirtualBox

Changeset 97918 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Dec 30, 2022 3:59:06 PM (2 years ago)
Author:
vboxsync
Message:

Add/VBoxGuestR0LibPhysHeap.cpp: Use a fixed minimum size for splitting of a free node during allocation. This used to be the same as the allocation size, which typically results in more internal fragmentation that necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibPhysHeap.cpp

    r97913 r97918  
    9191
    9292/** Threshold at which to split out a tail free block when allocating.
    93  * The value is the amount of user space, i.e. excluding the header.  */
     93 *
     94 * The value gives the amount of user space, i.e. excluding the header.
     95 *
     96 * Using 32 bytes based on VMMDev.h request sizes.  The smallest requests are 24
     97 * bytes, i.e. only the header, at least 4 of these.  There are at least 10 with
     98 * size 28 bytes and at least 11 with size 32 bytes.  So, 32 bytes would fit
     99 * some 25 requests out of about 60, which is reasonable.
     100 */
    94101#define VBGL_PH_MIN_SPLIT_FREE_BLOCK    32
    95102
     
    485492        /* We have a free block, either found or allocated. */
    486493
    487 #if 1   /** @todo r=bird: This might work okay for medium sizes, but it can't be good for small
    488          * allocations (unnecessary extra work) nor for large ones (internal fragmentation). */
    489         if (pBlock->cbDataSize > 2 * (cbSize + sizeof(VBGLPHYSHEAPBLOCK)))
    490 #else
    491494        if (pBlock->cbDataSize >= sizeof(VBGLPHYSHEAPBLOCK) * 2 + VBGL_PH_MIN_SPLIT_FREE_BLOCK + cbSize)
    492 #endif
    493495        {
    494496            /* Data will occupy less than a half of the block,
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