VOID
ExInitializePagedLookasideList(
IN PPAGED_LOOKASIDE_LIST Lookaside,
IN PALLOCATE_FUNCTION Allocate, /*
optional */
IN PFREE_FUNCTION Free, /*
optional */
IN ULONG Flags,
IN ULONG Size,
IN ULONG Tag,
IN USHORT Depth
);
ExInitializePagedLookasideList initializes a lookaside list of paged memory. After a successful initialization, fixed-size blocks can be allocated from and freed to the lookaside list.
typedef struct _PAGED_LOOKASIDE_LIST { SLIST_HEADER ListHead; USHORT Depth; USHORT Pad; ULONG TotalAllocates; ULONG AllocateMisses; ULONG TotalFrees; ULONG FreeMisses; POOL_TYPE Type; ULONG Tag; ULONG Size; PALLOCATE_FUNCTION Allocate; PFREE_FUNCTION Free; LIST_ENTRY ListEntry; FAST_MUTEX Lock; } PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;
None.
ExInitializePagedLookasideList does the following:
ExInitializePagedLookasideList initializes the list header but does not allocate memory for list entries. The initial entries are allocated on an as-needed basis by the Lookaside.Allocate routine. The list becomes populated as entries are freed back to the list. Entries collect on the list until Lookaside.Depth is reached. Once Depth entries are on the list, any additional entries that are freed are returned to paged pool using the Lookaside.Free routine. If the list becomes empty, allocate requests are satisfied by the Lookaside.Allocate routine.
The OS maintains a list of all the paged lookaside lists being used on the system.
For optimal performance, the OS uses an 8-byte compare exchange operation to synchronize access to the lookaside list if such an instruction is available. On platforms where such an instruction is not available, the fast mutex is used.
If the POOL_ALLOCATE_RAISE_IF_FAILURE flag is set, the system raises an an exception instead of returning NULL if an allocate fails.
Callers of ExInitializePagedLookasideList must be running at IRQL < DISPATCH_LEVEL.
ExAllocateFromPagedLookasideList, ExAllocatePoolWithTag, ExDeletePagedLookasideList, ExFreePool, ExFreeToPagedLookasideList, ExInitializeNPagedLookasideList