mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:03:12 +00:00
[NTOSKRNL]
Move acquisition of PFN lock into MmAllocPage and MmDereferencePage svn path=/trunk/; revision=64586
This commit is contained in:
parent
ca00c95ea5
commit
2d22f6f372
2 changed files with 10 additions and 13 deletions
|
@ -98,7 +98,6 @@ MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
|
||||||
{
|
{
|
||||||
PMM_ALLOCATION_REQUEST Request;
|
PMM_ALLOCATION_REQUEST Request;
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
KIRQL OldIrql;
|
|
||||||
|
|
||||||
if (Page == 0)
|
if (Page == 0)
|
||||||
{
|
{
|
||||||
|
@ -112,9 +111,7 @@ MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
|
||||||
(void)InterlockedDecrementUL(&MiMemoryConsumers[Consumer].PagesUsed);
|
(void)InterlockedDecrementUL(&MiMemoryConsumers[Consumer].PagesUsed);
|
||||||
if ((Entry = ExInterlockedRemoveHeadList(&AllocationListHead, &AllocationListLock)) == NULL)
|
if ((Entry = ExInterlockedRemoveHeadList(&AllocationListHead, &AllocationListLock)) == NULL)
|
||||||
{
|
{
|
||||||
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
|
||||||
MmDereferencePage(Page);
|
MmDereferencePage(Page);
|
||||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -126,9 +123,7 @@ MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
|
||||||
MmDereferencePage(Page);
|
MmDereferencePage(Page);
|
||||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
|
@ -259,7 +254,6 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
||||||
{
|
{
|
||||||
ULONG PagesUsed;
|
ULONG PagesUsed;
|
||||||
PFN_NUMBER Page;
|
PFN_NUMBER Page;
|
||||||
KIRQL OldIrql;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure we don't exceed our individual target.
|
* Make sure we don't exceed our individual target.
|
||||||
|
@ -276,9 +270,7 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
||||||
*/
|
*/
|
||||||
if ((Consumer == MC_SYSTEM) || MiIsBalancerThread())
|
if ((Consumer == MC_SYSTEM) || MiIsBalancerThread())
|
||||||
{
|
{
|
||||||
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
|
||||||
Page = MmAllocPage(Consumer);
|
Page = MmAllocPage(Consumer);
|
||||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
|
||||||
if (Page == 0)
|
if (Page == 0)
|
||||||
{
|
{
|
||||||
KeBugCheck(NO_PAGES_AVAILABLE);
|
KeBugCheck(NO_PAGES_AVAILABLE);
|
||||||
|
@ -337,9 +329,7 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
||||||
/*
|
/*
|
||||||
* Actually allocate the page.
|
* Actually allocate the page.
|
||||||
*/
|
*/
|
||||||
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
|
||||||
Page = MmAllocPage(Consumer);
|
Page = MmAllocPage(Consumer);
|
||||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
|
||||||
if (Page == 0)
|
if (Page == 0)
|
||||||
{
|
{
|
||||||
KeBugCheck(NO_PAGES_AVAILABLE);
|
KeBugCheck(NO_PAGES_AVAILABLE);
|
||||||
|
|
|
@ -532,8 +532,11 @@ NTAPI
|
||||||
MmDereferencePage(PFN_NUMBER Pfn)
|
MmDereferencePage(PFN_NUMBER Pfn)
|
||||||
{
|
{
|
||||||
PMMPFN Pfn1;
|
PMMPFN Pfn1;
|
||||||
|
KIRQL OldIrql;
|
||||||
DPRINT("MmDereferencePage(PhysicalAddress %x)\n", Pfn << PAGE_SHIFT);
|
DPRINT("MmDereferencePage(PhysicalAddress %x)\n", Pfn << PAGE_SHIFT);
|
||||||
|
|
||||||
|
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||||
|
|
||||||
Pfn1 = MiGetPfnEntry(Pfn);
|
Pfn1 = MiGetPfnEntry(Pfn);
|
||||||
ASSERT(Pfn1);
|
ASSERT(Pfn1);
|
||||||
ASSERT_IS_ROS_PFN(Pfn1);
|
ASSERT_IS_ROS_PFN(Pfn1);
|
||||||
|
@ -552,6 +555,8 @@ MmDereferencePage(PFN_NUMBER Pfn)
|
||||||
DPRINT("Legacy free: %lx\n", Pfn);
|
DPRINT("Legacy free: %lx\n", Pfn);
|
||||||
MiInsertPageInFreeList(Pfn);
|
MiInsertPageInFreeList(Pfn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
PFN_NUMBER
|
PFN_NUMBER
|
||||||
|
@ -560,13 +565,14 @@ MmAllocPage(ULONG Type)
|
||||||
{
|
{
|
||||||
PFN_NUMBER PfnOffset;
|
PFN_NUMBER PfnOffset;
|
||||||
PMMPFN Pfn1;
|
PMMPFN Pfn1;
|
||||||
|
KIRQL OldIrql;
|
||||||
|
|
||||||
|
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||||
|
|
||||||
PfnOffset = MiRemoveZeroPage(MI_GET_NEXT_COLOR());
|
PfnOffset = MiRemoveZeroPage(MI_GET_NEXT_COLOR());
|
||||||
|
|
||||||
if (!PfnOffset)
|
if (!PfnOffset)
|
||||||
{
|
{
|
||||||
DPRINT1("MmAllocPage(): Out of memory\n");
|
KeBugCheck(NO_PAGES_AVAILABLE);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Legacy allocate: %lx\n", PfnOffset);
|
DPRINT("Legacy allocate: %lx\n", PfnOffset);
|
||||||
|
@ -581,6 +587,7 @@ MmAllocPage(ULONG Type)
|
||||||
Pfn1->u1.SwapEntry = 0;
|
Pfn1->u1.SwapEntry = 0;
|
||||||
Pfn1->RmapListHead = NULL;
|
Pfn1->RmapListHead = NULL;
|
||||||
|
|
||||||
|
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||||
return PfnOffset;
|
return PfnOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue