VirtualBox

Changeset 91446 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Sep 28, 2021 7:53:25 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
147129
Message:

IPRT/memobj: Adding RTR0MemObjAllocLarge for speeding up large page allocations. bugref:5324

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/mangling.h

    r90995 r91446  
    18431843# define RTR0MemKernelCopyTo                            RT_MANGLER(RTR0MemKernelCopyTo)        /* r0drv */
    18441844# define RTR0MemObjAllocContTag                         RT_MANGLER(RTR0MemObjAllocContTag)     /* r0drv */
     1845# define RTR0MemObjAllocLargeTag                        RT_MANGLER(RTR0MemObjAllocLargeTag)    /* r0drv */
    18451846# define RTR0MemObjAllocLowTag                          RT_MANGLER(RTR0MemObjAllocLowTag)      /* r0drv */
    18461847# define RTR0MemObjAllocPageTag                         RT_MANGLER(RTR0MemObjAllocPageTag)     /* r0drv */
  • trunk/include/iprt/memobj.h

    r90715 r91446  
    151151 */
    152152RTR0DECL(int) RTR0MemObjAllocPageTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
     153
     154/**
     155 * Allocates large page aligned virtual kernel memory (default tag).
     156 *
     157 * Each large page in the allocation is backed by a contiguous chunk of physical
     158 * memory aligned to the page size.  The memory is taken from a non paged (=
     159 * fixed physical memory backing) pool.
     160 *
     161 * On some hosts we only support allocating a single large page at a time, they
     162 * will return VERR_NOT_SUPPORTED if @a cb is larger than @a cbLargePage.
     163 *
     164 * @returns IPRT status code.
     165 * @retval  VERR_TRY_AGAIN instead of VERR_NO_MEMORY when
     166 *          RTMEMOBJ_ALLOC_LARGE_F_FAST is set and supported.
     167 * @param   pMemObj         Where to store the ring-0 memory object handle.
     168 * @param   cb              Number of bytes to allocate. This is rounded up to
     169 *                          nearest large page.
     170 * @param   cbLargePage     The large page size.  The allowed values varies from
     171 *                          architecture to architecture and the paging mode
     172 *                          used by the OS.
     173 * @param   fFlags          Flags, RTMEMOBJ_ALLOC_LARGE_F_XXX.
     174 * @param   pszTag          Allocation tag used for statistics and such.
     175 *
     176 * @note    The implicit kernel mapping of this allocation does not necessarily
     177 *          have to be aligned on a @a cbLargePage boundrary.
     178 */
     179#define RTR0MemObjAllocLarge(pMemObj, cb, cbLargePage, fFlags) \
     180    RTR0MemObjAllocLargeTag((pMemObj), (cb), (cbLargePage), (fFlags), RTMEM_TAG)
     181
     182/**
     183 * Allocates large page aligned virtual kernel memory (custom tag).
     184 *
     185 * Each large page in the allocation is backed by a contiguous chunk of physical
     186 * memory aligned to the page size.  The memory is taken from a non paged (=
     187 * fixed physical memory backing) pool.
     188 *
     189 * On some hosts we only support allocating a single large page at a time, they
     190 * will return VERR_NOT_SUPPORTED if @a cb is larger than @a cbLargePage.
     191 *
     192 * @returns IPRT status code.
     193 * @retval  VERR_TRY_AGAIN instead of VERR_NO_MEMORY when
     194 *          RTMEMOBJ_ALLOC_LARGE_F_FAST is set and supported.
     195 * @param   pMemObj         Where to store the ring-0 memory object handle.
     196 * @param   cb              Number of bytes to allocate. This is rounded up to
     197 *                          nearest large page.
     198 * @param   cbLargePage     The large page size.  The allowed values varies from
     199 *                          architecture to architecture and the paging mode
     200 *                          used by the OS.
     201 * @param   fFlags          Flags, RTMEMOBJ_ALLOC_LARGE_F_XXX.
     202 * @param   pszTag          Allocation tag used for statistics and such.
     203 *
     204 * @note    The implicit kernel mapping of this allocation does not necessarily
     205 *          have to be aligned on a @a cbLargePage boundrary.
     206 */
     207RTR0DECL(int) RTR0MemObjAllocLargeTag(PRTR0MEMOBJ pMemObj, size_t cb, size_t cbLargePage, uint32_t fFlags, const char *pszTag);
     208
     209/** @name RTMEMOBJ_ALLOC_LARGE_F_XXX
     210 * @{ */
     211/** Indicates that it is okay to fail if there aren't enough large pages handy,
     212 * cancelling any expensive search and reshuffling of memory (when supported).
     213 * @note This flag can't be realized on all OSes.  (Those who do support it
     214 *       will return VERR_TRY_AGAIN instead of VERR_NO_MEMORY if they
     215 *       cannot satisfy the request.) */
     216#define RTMEMOBJ_ALLOC_LARGE_F_FAST         RT_BIT_32(0)
     217/** Mask with valid bits.   */
     218#define RTMEMOBJ_ALLOC_LARGE_F_VALID_MASK   UINT32_C(0x00000001)
     219/** @} */
    153220
    154221/**
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