/* GLOBALS ******************************************************************/
static FAST_MUTEX RmapListLock;
+static NPAGED_LOOKASIDE_LIST RmapLookasideList;
/* FUNCTIONS ****************************************************************/
MmInitializeRmapList(VOID)
{
ExInitializeFastMutex(&RmapListLock);
+ ExInitializeNPagedLookasideList (&RmapLookasideList,
+ NULL,
+ NULL,
+ 0,
+ sizeof(MM_RMAP_ENTRY),
+ TAG_RMAP,
+ 50);
}
NTSTATUS
MemoryArea = MmOpenMemoryAreaByAddress(&Process->AddressSpace, Address);
if (MemoryArea == NULL)
{
+ MmUnlockAddressSpace(&Process->AddressSpace);
ObDereferenceObject(Process);
return(STATUS_UNSUCCESSFUL);
}
Address = (PVOID)PAGE_ROUND_DOWN(Address);
- new_entry = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_RMAP_ENTRY), TAG_RMAP);
+ new_entry = ExAllocateFromNPagedLookasideList(&RmapLookasideList);
if (new_entry == NULL)
{
KeBugCheck(0);
DeleteMapping(Context, previous_entry->Process,
previous_entry->Address);
}
- ExFreePool(previous_entry);
+ ExFreeToNPagedLookasideList(&RmapLookasideList, previous_entry);
}
MmSetRmapListHeadPage(PhysicalAddress, NULL);
ExReleaseFastMutex(&RmapListLock);
if (previous_entry == NULL)
{
MmSetRmapListHeadPage(PhysicalAddress, current_entry->Next);
- ExReleaseFastMutex(&RmapListLock);
- ExFreePool(current_entry);
}
else
{
previous_entry->Next = current_entry->Next;
- ExReleaseFastMutex(&RmapListLock);
- ExFreePool(current_entry);
}
+ ExReleaseFastMutex(&RmapListLock);
+ ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry);
return;
}
previous_entry = current_entry;