- Delete the blaoted, overweight and slow nonpaged pool implementation.

- Plug-in support to use the ARM nonpaged pool instead.
- This patch has been tested for over 2 months and all known regressions were fixed.
  - Thanks to Aleksey Bragin for providing a pool regression suite.
  - Thanks to Aleksey Bragin for providing initial implementation details and code from older attempts.
  - Thanks to http://uninformed.org/?v=4&a=2&t=txt and http://www.dfrws.org/2008/proceedings/p58-schuster_pres.pdf for allocation strategies.


svn path=/trunk/; revision=42249
This commit is contained in:
ReactOS Portable Systems Group 2009-07-27 00:14:56 +00:00
parent 1eba02fc2f
commit 5899e14bd1
4 changed files with 18 additions and 1883 deletions

View file

@ -45,8 +45,6 @@ MemType[] =
"LoaderXIPRom "
};
PVOID MiNonPagedPoolStart;
ULONG MiNonPagedPoolLength;
PBOOLEAN Mm64BitPhysicalAddress = FALSE;
ULONG MmReadClusterSize;
MM_STATS MmStats;
@ -160,18 +158,10 @@ MmInit1(VOID)
// Initialize ARM³ in phase 1
//
MmArmInitSystem(1, KeLoaderBlock);
// DEPRECATED
/* Put nonpaged pool after the loaded modules */ // DEPRECATED
MiNonPagedPoolStart = (PVOID)((ULONG_PTR)MmSystemRangeStart + // DEPRECATED
MmBootImageSize); // DEPRECATED
MiNonPagedPoolLength = MM_NONPAGED_POOL_SIZE; // DEPRECATED
// DEPRECATED
/* Initialize nonpaged pool */ // DEPRECATED
MiInitializeNonPagedPool(); // DEPRECATED
// DEPRECATED
/* Put the paged pool after nonpaged pool */
MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MiNonPagedPoolStart +
MiNonPagedPoolLength);
/* Put the paged pool after the loaded modules */
MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MmSystemRangeStart +
MmBootImageSize);
MmPagedPoolSize = MM_PAGED_POOL_SIZE;
//

File diff suppressed because it is too large Load diff

View file

@ -33,6 +33,12 @@ EiGetPagedPoolTag(IN PVOID Block);
ULONG NTAPI
EiGetNonPagedPoolTag(IN PVOID Block);
PVOID
NTAPI
ExAllocateArmPoolWithTag(POOL_TYPE PoolType,
SIZE_T NumberOfBytes,
ULONG Tag);
static PVOID NTAPI
EiAllocatePool(POOL_TYPE PoolType,
ULONG NumberOfBytes,
@ -75,7 +81,7 @@ EiAllocatePool(POOL_TYPE PoolType,
Block = ExpAllocateDebugPool(PoolType, NumberOfBytes, Tag, Caller, TRUE);
else
#endif
Block = ExAllocateNonPagedPoolWithTag(PoolType, NumberOfBytes, Tag, Caller);
Block = ExAllocateArmPoolWithTag(PoolType, NumberOfBytes, Tag);
}
if ((PoolType & MUST_SUCCEED_POOL_MASK) && !Block)
@ -183,19 +189,8 @@ ExAllocatePoolWithTagPriority(
IN EX_POOL_PRIORITY Priority
)
{
/* Check if this is one of the "Special" Flags, used by the Verifier */
if (Priority & 8) {
/* Check if this is a xxSpecialUnderrun */
if (Priority & 1) {
return MiAllocateSpecialPool(PoolType, NumberOfBytes, Tag, 1);
} else { /* xxSpecialOverrun */
return MiAllocateSpecialPool(PoolType, NumberOfBytes, Tag, 0);
}
}
/* FIXME: Do Ressource Checking Based on Priority and fail if resources too low*/
/* Do the allocation */
UNIMPLEMENTED;
return ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);
}
@ -253,6 +248,11 @@ ExFreePool(IN PVOID Block)
ExFreePoolWithTag(Block, 0);
}
VOID
NTAPI
ExFreeArmPoolWithTag(PVOID P,
ULONG TagToFree);
/*
* @implemented
*/
@ -291,36 +291,7 @@ ExFreePoolWithTag(
#endif
ExFreePagedPool(Block);
}
/* Check for non-paged pool */
else if (Block >= MiNonPagedPoolStart &&
(char*)Block < ((char*)MiNonPagedPoolStart + MiNonPagedPoolLength))
{
/* Validate tag */
#ifndef DEBUG_NPOOL
if (Tag != 0 && Tag != EiGetNonPagedPoolTag(Block))
KeBugCheckEx(BAD_POOL_CALLER,
0x0a,
(ULONG_PTR)Block,
EiGetNonPagedPoolTag(Block),
Tag);
#endif
/* Validate IRQL */
if (KeGetCurrentIrql() > DISPATCH_LEVEL)
KeBugCheckEx(BAD_POOL_CALLER,
0x09,
KeGetCurrentIrql(),
NonPagedPool,
(ULONG_PTR)Block);
/* Free from non-paged pool */
#ifdef DEBUG_NPOOL
if (ExpIsPoolTagDebuggable(Tag))
ExpFreeDebugPool(Block, FALSE);
else
#endif
ExFreeNonPagedPool(Block);
}
else if (Block) return ExFreeArmPoolWithTag(Block, Tag);
else
{
/* Warn only for NULL pointers */
@ -403,13 +374,6 @@ MiRaisePoolQuota(
/* Check if we still have 200 pages free*/
if (MmStats.NrFreePages < 200) return FALSE;
/* Check that 4MB is still left */
if ((MM_NONPAGED_POOL_SIZE >> 12) < ((MiNonPagedPoolLength + 4194304) >> 12)) {
return FALSE;
}
/* Increase Non Paged Pool Quota by 64K */
MmTotalNonPagedPoolQuota += 65536;
*NewMaxQuota = CurrentMaxQuota + 65536;
return TRUE;
}

View file

@ -390,7 +390,6 @@
<file>mmsup.c</file>
<file>mminit.c</file>
<file>mpw.c</file>
<file>npool.c</file>
<file>pagefile.c</file>
<file>pageop.c</file>
<file>pe.c</file>