mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
More swapping fixes
svn path=/trunk/; revision=2495
This commit is contained in:
parent
3a8ce6bf63
commit
fe7d926068
4 changed files with 39 additions and 17 deletions
|
@ -18,7 +18,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dpc.c,v 1.21 2001/04/03 17:25:49 dwelch Exp $
|
/* $Id: dpc.c,v 1.22 2002/01/09 03:00:20 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: pageop.c,v 1.5 2001/04/04 22:21:31 dwelch Exp $
|
/* $Id: pageop.c,v 1.6 2002/01/09 03:00:21 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
#define PAGEOP_HASH_TABLE_SIZE (32)
|
#define PAGEOP_HASH_TABLE_SIZE (32)
|
||||||
|
|
||||||
KSPIN_LOCK MmPageOpHashTableLock;
|
KSPIN_LOCK MmPageOpHashTableLock;
|
||||||
PMM_PAGEOP MmPageOpHashTable[PAGEOP_HASH_TABLE_SIZE];
|
PMM_PAGEOP MmPageOpHashTable[PAGEOP_HASH_TABLE_SIZE] = {NULL, } ;
|
||||||
|
|
||||||
#define TAG_MM_PAGEOP TAG('M', 'P', 'O', 'P')
|
#define TAG_MM_PAGEOP TAG('M', 'P', 'O', 'P')
|
||||||
|
|
||||||
|
@ -38,13 +38,13 @@ MmReleasePageOp(PMM_PAGEOP PageOp)
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
PMM_PAGEOP PrevPageOp;
|
PMM_PAGEOP PrevPageOp;
|
||||||
|
|
||||||
|
KeAcquireSpinLock(&MmPageOpHashTableLock, &oldIrql);
|
||||||
PageOp->ReferenceCount--;
|
PageOp->ReferenceCount--;
|
||||||
if (PageOp->ReferenceCount > 0)
|
if (PageOp->ReferenceCount > 0)
|
||||||
{
|
{
|
||||||
|
KeReleaseSpinLock(&MmPageOpHashTableLock, oldIrql);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeAcquireSpinLock(&MmPageOpHashTableLock, &oldIrql);
|
|
||||||
PrevPageOp = MmPageOpHashTable[PageOp->Hash];
|
PrevPageOp = MmPageOpHashTable[PageOp->Hash];
|
||||||
if (PrevPageOp == PageOp)
|
if (PrevPageOp == PageOp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: section.c,v 1.75 2002/01/08 00:49:00 dwelch Exp $
|
/* $Id: section.c,v 1.76 2002/01/09 03:00:21 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/section.c
|
* FILE: ntoskrnl/mm/section.c
|
||||||
|
@ -1226,7 +1226,8 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
Context.Segment = Segment;
|
Context.Segment = Segment;
|
||||||
Context.Offset = Offset;
|
Context.Offset = Offset;
|
||||||
Context.WasDirty = FALSE;
|
Context.WasDirty = FALSE;
|
||||||
if (IS_SWAP_FROM_SSE(Entry) ||
|
if (Segment->Characteristics & IMAGE_SECTION_CHAR_BSS ||
|
||||||
|
IS_SWAP_FROM_SSE(Entry) ||
|
||||||
(PVOID)(PAGE_FROM_SSE(Entry)) != PhysicalAddress)
|
(PVOID)(PAGE_FROM_SSE(Entry)) != PhysicalAddress)
|
||||||
{
|
{
|
||||||
Context.Private = Private = TRUE;
|
Context.Private = Private = TRUE;
|
||||||
|
@ -1319,7 +1320,8 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
}
|
}
|
||||||
if (Private)
|
if (Private)
|
||||||
{
|
{
|
||||||
if (SwapEntry == 0)
|
if (!(Segment->Characteristics & IMAGE_SECTION_CHAR_BSS) &&
|
||||||
|
SwapEntry == 0)
|
||||||
{
|
{
|
||||||
DPRINT1("Private page, non-dirty but not swapped out "
|
DPRINT1("Private page, non-dirty but not swapped out "
|
||||||
"process %d address 0x%.8X\n",
|
"process %d address 0x%.8X\n",
|
||||||
|
@ -1396,6 +1398,9 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
(ULONG)PhysicalAddress,
|
(ULONG)PhysicalAddress,
|
||||||
FALSE);
|
FALSE);
|
||||||
MmSetDirtyPage(MemoryArea->Process, Address);
|
MmSetDirtyPage(MemoryArea->Process, Address);
|
||||||
|
MmInsertRmap(PhysicalAddress,
|
||||||
|
MemoryArea->Process,
|
||||||
|
Address);
|
||||||
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart,
|
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart,
|
||||||
(ULONG)PhysicalAddress);
|
(ULONG)PhysicalAddress);
|
||||||
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
||||||
|
@ -1441,6 +1446,9 @@ MmPageOutSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
(ULONG)PhysicalAddress,
|
(ULONG)PhysicalAddress,
|
||||||
FALSE);
|
FALSE);
|
||||||
MmSetDirtyPage(MemoryArea->Process, Address);
|
MmSetDirtyPage(MemoryArea->Process, Address);
|
||||||
|
MmInsertRmap(PhysicalAddress,
|
||||||
|
MemoryArea->Process,
|
||||||
|
Address);
|
||||||
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart,
|
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart,
|
||||||
(ULONG)PhysicalAddress);
|
(ULONG)PhysicalAddress);
|
||||||
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
|
||||||
|
@ -2579,11 +2587,15 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, ULONG P
|
||||||
|
|
||||||
Entry = MmGetPageEntrySectionSegment(MArea->Data.SectionData.Segment,
|
Entry = MmGetPageEntrySectionSegment(MArea->Data.SectionData.Segment,
|
||||||
Offset);
|
Offset);
|
||||||
|
if (IS_SWAP_FROM_SSE(Entry))
|
||||||
|
{
|
||||||
|
KeBugCheck(0);
|
||||||
|
}
|
||||||
|
else if (PhysAddr != (PAGE_FROM_SSE(Entry)))
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Just dereference private pages
|
* Just dereference private pages
|
||||||
*/
|
*/
|
||||||
if (PhysAddr != (Entry & 0xFFFFF000))
|
|
||||||
{
|
|
||||||
MmDeleteRmap((PVOID)PhysAddr, MArea->Process, Address);
|
MmDeleteRmap((PVOID)PhysAddr, MArea->Process, Address);
|
||||||
MmDereferencePage((PVOID)PhysAddr);
|
MmDereferencePage((PVOID)PhysAddr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: virtual.c,v 1.54 2002/01/08 00:49:01 dwelch Exp $
|
/* $Id: virtual.c,v 1.55 2002/01/09 03:00:21 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top directory
|
* COPYRIGHT: See COPYING in the top directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -119,6 +119,11 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
||||||
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE,
|
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE,
|
||||||
NULL, (PULONG)&PhysicalAddress);
|
NULL, (PULONG)&PhysicalAddress);
|
||||||
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
||||||
|
if (MmGetSavedSwapEntryPage(PhysicalAddress) != 0)
|
||||||
|
{
|
||||||
|
DPRINT1("Read-only page was swapped out.\n");
|
||||||
|
KeBugCheck(0);
|
||||||
|
}
|
||||||
MmReleasePageMemoryConsumer(MC_USER, PhysicalAddress);
|
MmReleasePageMemoryConsumer(MC_USER, PhysicalAddress);
|
||||||
|
|
||||||
PageOp->Status = STATUS_SUCCESS;
|
PageOp->Status = STATUS_SUCCESS;
|
||||||
|
@ -140,6 +145,11 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
||||||
{
|
{
|
||||||
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(MemoryArea->Process, Address, FALSE, NULL, NULL);
|
||||||
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
MmDeleteAllRmaps(PhysicalAddress, NULL, NULL);
|
||||||
|
if ((SwapEntry = MmGetSavedSwapEntryPage(PhysicalAddress)) != 0)
|
||||||
|
{
|
||||||
|
MmCreatePageFileMapping(MemoryArea->Process, Address, SwapEntry);
|
||||||
|
MmSetSavedSwapEntryPage(PhysicalAddress, 0);
|
||||||
|
}
|
||||||
MmReleasePageMemoryConsumer(MC_USER, PhysicalAddress);
|
MmReleasePageMemoryConsumer(MC_USER, PhysicalAddress);
|
||||||
PageOp->Status = STATUS_SUCCESS;
|
PageOp->Status = STATUS_SUCCESS;
|
||||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||||
|
|
Loading…
Reference in a new issue