- Fix for lengthy delays when freeing a memory area. Don't attach/detach

another process when deleting each page table entry.

svn path=/trunk/; revision=5211
This commit is contained in:
David Welch 2003-07-21 21:41:21 +00:00
parent a3cf0cbc62
commit b9185cc4c4

View file

@ -367,6 +367,7 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
{
MEMORY_AREA* MemoryArea;
ULONG i;
PEPROCESS CurrentProcess = PsGetCurrentProcess();
DPRINT("MmFreeMemoryArea(AddressSpace %x, BaseAddress %x, Length %x,"
"FreePageContext %d)\n",AddressSpace,BaseAddress,Length,
@ -379,6 +380,11 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
KeBugCheck(0);
return(STATUS_UNSUCCESSFUL);
}
if (AddressSpace->Process != NULL &&
AddressSpace->Process != CurrentProcess)
{
KeAttachProcess(AddressSpace->Process);
}
for (i=0; i<(PAGE_ROUND_UP(MemoryArea->Length)/PAGE_SIZE); i++)
{
PHYSICAL_ADDRESS PhysAddr = (PHYSICAL_ADDRESS)0LL;
@ -406,7 +412,11 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
SwapEntry, Dirty);
}
}
if (AddressSpace->Process != NULL &&
AddressSpace->Process != CurrentProcess)
{
KeDetachProcess();
}
RemoveEntryList(&MemoryArea->Entry);
ExFreePool(MemoryArea);