Files
@ d6b9b2ac5869
Branch filter:
Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public-bincomp/vmkernel64/release/core/vmkapi_pageslab.h
d6b9b2ac5869
6.2 KiB
text/x-chdr
ESXi-5.5-U2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | /* **********************************************************
* Copyright 2012 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* @VMKAPIMOD_LICENSE@
*/
/*
***********************************************************************
* PageSlab */ /**
* \addtogroup Core
* @{
* \defgroup PageSlab Slab page allocator
*
* Functions related to page slabs. A page slab is a page-wise
* allocator that allows for fast page allocations and freeing.
*
* @{
***********************************************************************
*/
#ifndef _VMKAPI_PAGESLAB_H_
#define _VMKAPI_PAGESLAB_H_
/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */
/** \brief INVALID page slab ID */
#define VMK_INVALID_PAGESLAB_ID ((vmk_PageSlabID)NULL)
/** \brief Page slab ID */
typedef struct vmkPageSlabInt* vmk_PageSlabID;
/**
* \brief Properties of a page slab.
*/
typedef struct vmk_PageSlabCreateProps {
/** \brief Heap to allocate page slab metadata from. The size of the
* allocation can be retrieved via vmk_PageSlabAllocationSize.
*/
vmk_HeapID heapID;
/** \brief Name for this page slab. */
vmk_Name name;
/** \brief Minimum number of pages that should be held in the slab.
* Please be careful when sizing this number as any memory
* that is used for the minimum will be unavailable to VMs, etc.
*/
vmk_uint32 minPages;
/** \brief Maximum number of pages that the slab should provide for. */
vmk_uint32 maxPages;
/** \brief Restrictions on the physical address space that pages for
* the page slab are allocated from. Please choose the least
* restrictive constraint possible as memory below 2GB or 4GB
* is a scarce resource.
*/
vmk_MemPhysAddrConstraint physRange;
/** \brief Memory pool that the slab should allocate pages from. Set to
* VMK_MEMPOOL_INVALID to have vmk_PageSlabCreate create a new
* memory pool for the slab.
*/
vmk_MemPool memPool;
} vmk_PageSlabCreateProps;
/*
***********************************************************************
* vmk_PageSlabCreateCustom -- */ /**
*
* \brief Create a new page slab.
*
* This function creates a new page slab with the given properties.
*
* \note This function might block.
*
* \param[in] moduleID Module ID of the module that this
* page slab will belong to.
* \param[in] createProps Properties of the new page slab.
* \param[out] pageSlabID Handle to the newly created page slab.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_PageSlabCreateCustom(vmk_ModuleID moduleID,
vmk_PageSlabCreateProps *createProps,
vmk_PageSlabID *pageSlabID);
/*
***********************************************************************
* vmk_PageSlabCreate -- */ /**
*
* \brief Convenience wrapper around vmk_PageSlabCreateCustom
*
* This function creates a new page slab with the given properties.
*
* \note This function might block.
*
* \param[in] createProps Properties of the new page slab.
* \param[out] pageSlabID Handle to the newly created page slab.
*
***********************************************************************
*/
static VMK_INLINE VMK_ReturnStatus
vmk_PageSlabCreate(vmk_PageSlabCreateProps *createProps,
vmk_PageSlabID *pageSlabID)
{
return vmk_PageSlabCreateCustom(vmk_ModuleCurrentID, createProps, pageSlabID);
}
/*
***********************************************************************
* vmk_PageSlabDestroy -- */ /**
*
* \brief Destroy a page slab.
*
* \note The page slab must be empty meaning all previously allocated
* pages must have been freed back to the slab.
* \note This function might block.
*
* \param[in] pageSlabID Page slab identifier acquired through a
* preceding vmk_PageSlabCreate(Custom) call.
*
***********************************************************************
*/
void
vmk_PageSlabDestroy(vmk_PageSlabID pageSlabID);
/*
***********************************************************************
* vmk_PageSlabAllocationSize -- */ /**
*
* \brief Return the amount of memory that vmk_PageSlabCreate is going
* to allocate from the passed in heap for each call.
*
* \note This function will not block.
*
***********************************************************************
*/
vmk_ByteCountSmall
vmk_PageSlabAllocationSize(void);
/*
***********************************************************************
* vmk_PageSlabAlloc -- */ /**
*
* \brief Allocate a page from the given page slab.
*
* \note This function may block based on the blocking parameter
*
* \param[in] pageSlabID Page slab previously created via
* vmk_PageSlabCreate(Custom)
* \param[in] blocking Allow the page slab to block and wait for
* a page to become free if none are readily
* available.
* \param[out] mpn Machine page number of the new page. Only
* filled if return status was VMK_OK;
*
* \retval VMK_NO_MEMORY The slab was unable to allocate a page.
*
***********************************************************************
*/
VMK_ReturnStatus
vmk_PageSlabAlloc(vmk_PageSlabID pageSlabID,
vmk_Bool blocking,
vmk_MPN *mpn);
/*
***********************************************************************
* vmk_PageSlabFree -- */ /**
*
* \brief Free a page to the given page slab.
*
* \param[in] pageSlabID Page slab previously created via
* vmk_PageSlabCreate(Custom)
* \param[in] mpn An machine page number previously returned
* by vmk_PageSlabAlloc
*
***********************************************************************
*/
void
vmk_PageSlabFree(vmk_PageSlabID pageSlabID,
vmk_MPN mpn);
#endif /* _VMKAPI_PAGESLAB_H_ */
/** @} */
/** @} */
|