mirror of
https://github.com/reactos/reactos.git
synced 2025-05-31 23:18:39 +00:00
[NEWCC]
Integrate september's speed improvements, which now work. Remove the flush hack when unpinning cache segments. svn path=/trunk/; revision=55839
This commit is contained in:
parent
e81ed04aa0
commit
b10383d1ff
4 changed files with 26 additions and 27 deletions
11
reactos/ntoskrnl/cache/pinsup.c
vendored
11
reactos/ntoskrnl/cache/pinsup.c
vendored
|
@ -130,6 +130,14 @@ VOID CcpDereferenceCache(ULONG Start, BOOLEAN Immediate)
|
||||||
|
|
||||||
DPRINT("Firing work item for %x\n", Bcb->BaseAddress);
|
DPRINT("Firing work item for %x\n", Bcb->BaseAddress);
|
||||||
|
|
||||||
|
if (Dirty) {
|
||||||
|
CcpUnlock();
|
||||||
|
Bcb->RefCount++;
|
||||||
|
MiFlushMappedSection(ToUnmap, &BaseOffset, &MappedSize, Dirty);
|
||||||
|
Bcb->RefCount--;
|
||||||
|
CcpLock();
|
||||||
|
}
|
||||||
|
|
||||||
if (Immediate)
|
if (Immediate)
|
||||||
{
|
{
|
||||||
PROS_SECTION_OBJECT ToDeref = Bcb->SectionObject;
|
PROS_SECTION_OBJECT ToDeref = Bcb->SectionObject;
|
||||||
|
@ -143,8 +151,6 @@ VOID CcpDereferenceCache(ULONG Start, BOOLEAN Immediate)
|
||||||
RemoveEntryList(&Bcb->ThisFileList);
|
RemoveEntryList(&Bcb->ThisFileList);
|
||||||
|
|
||||||
CcpUnlock();
|
CcpUnlock();
|
||||||
if (Dirty)
|
|
||||||
MiFlushMappedSection(ToUnmap, &BaseOffset, &MappedSize, Dirty);
|
|
||||||
MmUnmapCacheViewInSystemSpace(ToUnmap);
|
MmUnmapCacheViewInSystemSpace(ToUnmap);
|
||||||
ObDereferenceObject(ToDeref);
|
ObDereferenceObject(ToDeref);
|
||||||
CcpLock();
|
CcpLock();
|
||||||
|
@ -763,7 +769,6 @@ CcUnpinData(IN PVOID Bcb)
|
||||||
CcpUnlock();
|
CcpUnlock();
|
||||||
|
|
||||||
if (!Released) {
|
if (!Released) {
|
||||||
MiFlushMappedSection(RealBcb->BaseAddress, &RealBcb->FileOffset, &RealBcb->Map->FileSizes.FileSize, RealBcb->Dirty);
|
|
||||||
CcpLock();
|
CcpLock();
|
||||||
CcpUnpinData(RealBcb, TRUE);
|
CcpUnpinData(RealBcb, TRUE);
|
||||||
CcpUnlock();
|
CcpUnlock();
|
||||||
|
|
13
reactos/ntoskrnl/cache/section/data.c
vendored
13
reactos/ntoskrnl/cache/section/data.c
vendored
|
@ -259,6 +259,7 @@ _MiFlushMappedSection
|
||||||
if (NT_SUCCESS(Status)) {
|
if (NT_SUCCESS(Status)) {
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
MmSetCleanAllRmaps(Page);
|
MmSetCleanAllRmaps(Page);
|
||||||
|
MmSetPageProtect(MmGetAddressSpaceOwner(AddressSpace), (PVOID)PageAddress, PAGE_READONLY);
|
||||||
MmLockSectionSegment(Segment);
|
MmLockSectionSegment(Segment);
|
||||||
Entry = MmGetPageEntrySectionSegment(Segment, &FileOffset);
|
Entry = MmGetPageEntrySectionSegment(Segment, &FileOffset);
|
||||||
if (Entry && !IS_SWAP_FROM_SSE(Entry) && PFN_FROM_SSE(Entry) == Page)
|
if (Entry && !IS_SWAP_FROM_SSE(Entry) && PFN_FROM_SSE(Entry) == Page)
|
||||||
|
@ -663,6 +664,11 @@ MmFreeCacheSectionPage
|
||||||
|
|
||||||
Entry = MmGetPageEntrySectionSegment(Segment, &Offset);
|
Entry = MmGetPageEntrySectionSegment(Segment, &Offset);
|
||||||
|
|
||||||
|
if (Page != 0 && PFN_FROM_SSE(Entry) == Page && Dirty)
|
||||||
|
{
|
||||||
|
DPRINT("Freeing section page %x:%x -> %x\n", Segment, Offset.LowPart, Entry);
|
||||||
|
MmSetPageEntrySectionSegment(Segment, &Offset, DIRTY_SSE(Entry));
|
||||||
|
}
|
||||||
if (Page)
|
if (Page)
|
||||||
{
|
{
|
||||||
DPRINT("Removing page %x:%x -> %x\n", Segment, Offset.LowPart, Entry);
|
DPRINT("Removing page %x:%x -> %x\n", Segment, Offset.LowPart, Entry);
|
||||||
|
@ -671,12 +677,7 @@ MmFreeCacheSectionPage
|
||||||
MmDeleteVirtualMapping(Process, Address, FALSE, NULL, NULL);
|
MmDeleteVirtualMapping(Process, Address, FALSE, NULL, NULL);
|
||||||
MmReleasePageMemoryConsumer(MC_CACHE, Page);
|
MmReleasePageMemoryConsumer(MC_CACHE, Page);
|
||||||
}
|
}
|
||||||
if (Page != 0 && PFN_FROM_SSE(Entry) == Page && Dirty)
|
if (SwapEntry != 0)
|
||||||
{
|
|
||||||
DPRINT("Freeing section page %x:%x -> %x\n", Segment, Offset.LowPart, Entry);
|
|
||||||
MmSetPageEntrySectionSegment(Segment, &Offset, DIRTY_SSE(Entry));
|
|
||||||
}
|
|
||||||
else if (SwapEntry != 0)
|
|
||||||
{
|
{
|
||||||
MmFreeSwapPage(SwapEntry);
|
MmFreeSwapPage(SwapEntry);
|
||||||
}
|
}
|
||||||
|
|
1
reactos/ntoskrnl/cache/section/fault.c
vendored
1
reactos/ntoskrnl/cache/section/fault.c
vendored
|
@ -296,6 +296,7 @@ MiCowCacheSectionPage
|
||||||
MmSetPageEntrySectionSegment(Segment, &Offset, DIRTY_SSE(Entry));
|
MmSetPageEntrySectionSegment(Segment, &Offset, DIRTY_SSE(Entry));
|
||||||
}
|
}
|
||||||
MmSetPageProtect(Process, PAddress, PAGE_READWRITE);
|
MmSetPageProtect(Process, PAddress, PAGE_READWRITE);
|
||||||
|
MmSetDirtyPage(Process, PAddress);
|
||||||
MmUnlockSectionSegment(Segment);
|
MmUnlockSectionSegment(Segment);
|
||||||
DPRINT("Done\n");
|
DPRINT("Done\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
28
reactos/ntoskrnl/cache/section/swapout.c
vendored
28
reactos/ntoskrnl/cache/section/swapout.c
vendored
|
@ -184,11 +184,12 @@ MmPageOutCacheSection
|
||||||
(PMMSUPPORT AddressSpace,
|
(PMMSUPPORT AddressSpace,
|
||||||
MEMORY_AREA* MemoryArea,
|
MEMORY_AREA* MemoryArea,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
|
BOOLEAN Dirty,
|
||||||
PMM_REQUIRED_RESOURCES Required)
|
PMM_REQUIRED_RESOURCES Required)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
ULONG Entry;
|
ULONG Entry;
|
||||||
BOOLEAN Dirty = FALSE;
|
PFN_NUMBER OurPage;
|
||||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||||
LARGE_INTEGER TotalOffset;
|
LARGE_INTEGER TotalOffset;
|
||||||
PMM_SECTION_SEGMENT Segment;
|
PMM_SECTION_SEGMENT Segment;
|
||||||
|
@ -202,24 +203,16 @@ MmPageOutCacheSection
|
||||||
MmLockSectionSegment(Segment);
|
MmLockSectionSegment(Segment);
|
||||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||||
|
|
||||||
Dirty = MmIsDirtyPageRmap(Required->Page[0]);
|
|
||||||
Entry = MmGetPageEntrySectionSegment(Segment, &TotalOffset);
|
Entry = MmGetPageEntrySectionSegment(Segment, &TotalOffset);
|
||||||
|
|
||||||
if (Dirty)
|
if (Dirty) {
|
||||||
{
|
DPRINT("Dirty page: %p:%p segment %p offset %08x%08x\n", Process, Address, Segment, TotalOffset.HighPart, TotalOffset.LowPart);
|
||||||
PFN_NUMBER OurPage;
|
|
||||||
MmSetPageEntrySectionSegment(Segment, &TotalOffset, DIRTY_SSE(Entry));
|
MmSetPageEntrySectionSegment(Segment, &TotalOffset, DIRTY_SSE(Entry));
|
||||||
MmDeleteRmap(Required->Page[0], Process, Address);
|
}
|
||||||
MmDeleteVirtualMapping(Process, Address, FALSE, &Dirty, &OurPage);
|
|
||||||
ASSERT(OurPage == Required->Page[0]);
|
MmDeleteRmap(Required->Page[0], Process, Address);
|
||||||
} else {
|
MmDeleteVirtualMapping(Process, Address, FALSE, NULL, &OurPage);
|
||||||
/* Just unmap if the page wasn't dirty */
|
ASSERT(OurPage == Required->Page[0]);
|
||||||
PFN_NUMBER OurPage;
|
|
||||||
MmDeleteRmap(Required->Page[0], Process, Address);
|
|
||||||
MmDeleteVirtualMapping(Process, Address, FALSE, &Dirty, &OurPage);
|
|
||||||
DPRINT("OurPage %x ThePage %x\n", OurPage, Required->Page[0]);
|
|
||||||
ASSERT(OurPage == Required->Page[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -368,7 +361,7 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
|
|
||||||
DPRINT("%x:%x, page %x %x\n", Process, Address, Page, Resources.Page[0]);
|
DPRINT("%x:%x, page %x %x\n", Process, Address, Page, Resources.Page[0]);
|
||||||
Status = MmPageOutCacheSection
|
Status = MmPageOutCacheSection
|
||||||
(AddressSpace, MemoryArea, Address, &Resources);
|
(AddressSpace, MemoryArea, Address, Dirty, &Resources);
|
||||||
DPRINT("%x\n", Status);
|
DPRINT("%x\n", Status);
|
||||||
|
|
||||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||||
|
@ -398,7 +391,6 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
}
|
}
|
||||||
while (Status == STATUS_MM_RESTART_OPERATION);
|
while (Status == STATUS_MM_RESTART_OPERATION);
|
||||||
Dirty |= Resources.State & 1; // Accumulate dirty
|
|
||||||
|
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue