VirtualBox

Ignore:
Timestamp:
May 4, 2011 5:43:50 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
71558
Message:

rtR0MemAllocEx/linux: Avoid vmalloc, it's has serious performance issues. (I forget why we're switching between vmalloc and kmalloc here.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c

    r36555 r36962  
    240240    else
    241241    {
    242         if (cb <= PAGE_SIZE || (fFlags & RTMEMHDR_FLAG_ANY_CTX))
     242        if (
     243#if 1 /* vmalloc has serious performance issues, avoid it. */
     244               cb <= PAGE_SIZE*16 - sizeof(*pHdr)
     245#else
     246               cb <= PAGE_SIZE
     247#endif
     248            || (fFlags & RTMEMHDR_FLAG_ANY_CTX)
     249           )
    243250        {
    244251            fFlags |= RTMEMHDR_FLAG_KMALLOC;
    245252            pHdr = kmalloc(cb + sizeof(*pHdr),
    246253                           (fFlags & RTMEMHDR_FLAG_ANY_CTX_ALLOC) ? GFP_ATOMIC : GFP_KERNEL);
     254            if (RT_UNLIKELY(   !pHdr
     255                            && cb > PAGE_SIZE
     256                            && !(fFlags & RTMEMHDR_FLAG_ANY_CTX) ))
     257            {
     258                fFlags &= ~RTMEMHDR_FLAG_KMALLOC;
     259                pHdr = vmalloc(cb + sizeof(*pHdr));
     260            }
    247261        }
    248262        else
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