mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:36:11 +00:00
[NEWCC]
- Fix several locking issues to better fit with RosMm - Page out is critical as we use it now (shutdown) so force address space locking - Fix an address space lock leak for VM regions - Quiet some debugging and enable/change some other - Still some lingering issues in page out exist which seem to be related to zefklop's PDE ref counting stuff and a weird one where we fault on the PFN database - Besides the aforementioned issues, NewCC is surprisingly solid. I was able to boot to 3rd stage without a problem and run some apps. svn path=/trunk/; revision=55895
This commit is contained in:
parent
6086842a76
commit
29f3456caf
6 changed files with 18 additions and 14 deletions
2
reactos/ntoskrnl/cache/copysup.c
vendored
2
reactos/ntoskrnl/cache/copysup.c
vendored
|
@ -11,7 +11,7 @@
|
||||||
#include <ntoskrnl.h>
|
#include <ntoskrnl.h>
|
||||||
#include "newcc.h"
|
#include "newcc.h"
|
||||||
#include "section/newmm.h"
|
#include "section/newmm.h"
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS ********************************************************************/
|
/* GLOBALS ********************************************************************/
|
||||||
|
|
6
reactos/ntoskrnl/cache/mdlsup.c
vendored
6
reactos/ntoskrnl/cache/mdlsup.c
vendored
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include <ntoskrnl.h>
|
#include <ntoskrnl.h>
|
||||||
#include "newcc.h"
|
#include "newcc.h"
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS ********************************************************************/
|
/* GLOBALS ********************************************************************/
|
||||||
|
@ -95,7 +95,7 @@ NTAPI
|
||||||
CcMdlReadComplete2(IN PMDL MdlChain,
|
CcMdlReadComplete2(IN PMDL MdlChain,
|
||||||
IN PFILE_OBJECT FileObject)
|
IN PFILE_OBJECT FileObject)
|
||||||
{
|
{
|
||||||
DPRINT("Not sure\n");
|
UNIMPLEMENTED
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -128,7 +128,7 @@ CcMdlWriteComplete2(IN PFILE_OBJECT FileObject,
|
||||||
IN PLARGE_INTEGER FileOffset,
|
IN PLARGE_INTEGER FileOffset,
|
||||||
IN PMDL MdlChain)
|
IN PMDL MdlChain)
|
||||||
{
|
{
|
||||||
DPRINT("Not sure\n");
|
UNIMPLEMENTED
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
4
reactos/ntoskrnl/cache/pinsup.c
vendored
4
reactos/ntoskrnl/cache/pinsup.c
vendored
|
@ -230,7 +230,7 @@ ULONG CcpAllocateCacheSections
|
||||||
|
|
||||||
if (!RtlTestBit(CcCacheBitmap, i))
|
if (!RtlTestBit(CcCacheBitmap, i))
|
||||||
{
|
{
|
||||||
DPRINT("Somebody stoeled BCB #%x\n", i);
|
DPRINT1("Somebody stoeled BCB #%x\n", i);
|
||||||
}
|
}
|
||||||
ASSERT(RtlTestBit(CcCacheBitmap, i));
|
ASSERT(RtlTestBit(CcCacheBitmap, i));
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ ULONG CcpAllocateCacheSections
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT("Failed to allocate cache segment\n");
|
DPRINT1("Failed to allocate cache segment\n");
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
9
reactos/ntoskrnl/cache/section/swapout.c
vendored
9
reactos/ntoskrnl/cache/section/swapout.c
vendored
|
@ -328,12 +328,7 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
KeBugCheck(MEMORY_MANAGEMENT);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MmTryToLockAddressSpace(AddressSpace))
|
MmLockAddressSpace(AddressSpace);
|
||||||
{
|
|
||||||
DPRINT1("Could not lock address space for process %x\n", MmGetAddressSpaceOwner(AddressSpace));
|
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
|
||||||
goto bail;
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -495,12 +490,14 @@ MiRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed)
|
||||||
PMM_SECTION_SEGMENT Segment;
|
PMM_SECTION_SEGMENT Segment;
|
||||||
*NrFreed = 0;
|
*NrFreed = 0;
|
||||||
|
|
||||||
|
DPRINT1("Need to trim %d cache pages\n", Target);
|
||||||
for (Entry = MiSegmentList.Flink; *NrFreed < Target && Entry != &MiSegmentList; Entry = Entry->Flink) {
|
for (Entry = MiSegmentList.Flink; *NrFreed < Target && Entry != &MiSegmentList; Entry = Entry->Flink) {
|
||||||
Segment = CONTAINING_RECORD(Entry, MM_SECTION_SEGMENT, ListOfSegments);
|
Segment = CONTAINING_RECORD(Entry, MM_SECTION_SEGMENT, ListOfSegments);
|
||||||
// Defer to MM to try recovering pages from it
|
// Defer to MM to try recovering pages from it
|
||||||
Freed = MiCacheEvictPages(Segment, Target);
|
Freed = MiCacheEvictPages(Segment, Target);
|
||||||
*NrFreed += Freed;
|
*NrFreed += Freed;
|
||||||
}
|
}
|
||||||
|
DPRINT1("Evicted %d cache pages\n", Target);
|
||||||
|
|
||||||
if (!IsListEmpty(&MiSegmentList)) {
|
if (!IsListEmpty(&MiSegmentList)) {
|
||||||
Entry = MiSegmentList.Flink;
|
Entry = MiSegmentList.Flink;
|
||||||
|
|
|
@ -63,7 +63,11 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
// Special case for NEWCC: we can have a page that's only in a segment
|
// Special case for NEWCC: we can have a page that's only in a segment
|
||||||
// page table
|
// page table
|
||||||
if (entry && RMAP_IS_SEGMENT(entry->Address) && entry->Next == NULL)
|
if (entry && RMAP_IS_SEGMENT(entry->Address) && entry->Next == NULL)
|
||||||
|
{
|
||||||
|
/* NEWCC does locking itself */
|
||||||
|
ExReleaseFastMutex(&RmapListLock);
|
||||||
return MmpPageOutPhysicalAddress(Page);
|
return MmpPageOutPhysicalAddress(Page);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (entry && RMAP_IS_SEGMENT(entry->Address))
|
while (entry && RMAP_IS_SEGMENT(entry->Address))
|
||||||
|
@ -155,11 +159,14 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
}
|
}
|
||||||
else if (Type == MEMORY_AREA_CACHE)
|
else if (Type == MEMORY_AREA_CACHE)
|
||||||
{
|
{
|
||||||
|
/* NEWCC does locking itself */
|
||||||
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
Status = MmpPageOutPhysicalAddress(Page);
|
Status = MmpPageOutPhysicalAddress(Page);
|
||||||
}
|
}
|
||||||
else if (Type == MEMORY_AREA_VIRTUAL_MEMORY)
|
else if (Type == MEMORY_AREA_VIRTUAL_MEMORY)
|
||||||
{
|
{
|
||||||
/* Do not page out virtual memory during ARM3 transition */
|
/* Do not page out virtual memory during ARM3 transition */
|
||||||
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1218,7 +1218,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
Resources.Consumer = MC_USER;
|
Resources.Consumer = MC_USER;
|
||||||
Resources.Amount = PAGE_SIZE;
|
Resources.Amount = PAGE_SIZE;
|
||||||
|
|
||||||
DPRINT1("%S, offset %x, len %d, page %x\n", ((PFILE_OBJECT)Resources.Context)->FileName.Buffer, Resources.FileOffset.LowPart, Resources.Amount, Resources.Page[0]);
|
DPRINT("%S, offset 0x%x, len 0x%x, page 0x%x\n", ((PFILE_OBJECT)Resources.Context)->FileName.Buffer, Resources.FileOffset.LowPart, Resources.Amount, Resources.Page[0]);
|
||||||
|
|
||||||
Status = MiReadFilePage(MmGetKernelAddressSpace(), MemoryArea, &Resources);
|
Status = MiReadFilePage(MmGetKernelAddressSpace(), MemoryArea, &Resources);
|
||||||
*Page = Resources.Page[0];
|
*Page = Resources.Page[0];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue