https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9e121fb6c25077dedf9cfe...
commit 9e121fb6c25077dedf9cfeb74edda3f1ad411dbf Author: Jérôme Gardou jerome.gardou@reactos.org AuthorDate: Wed Mar 10 15:16:29 2021 +0100 Commit: Jérôme Gardou zefklop@users.noreply.github.com CommitDate: Thu Apr 8 15:40:37 2021 +0200
[NTOS:MM] Get rid of MmSetCleanAllRmaps and MmIsDirtyPageRmap
Everything is wrong with them. Bad locking. Bad logic. --- ntoskrnl/include/internal/mm.h | 7 ------ ntoskrnl/mm/rmap.c | 55 ------------------------------------------ ntoskrnl/mm/section.c | 5 +--- 3 files changed, 1 insertion(+), 66 deletions(-)
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h index d05360c28be..f5dd0a4e049 100644 --- a/ntoskrnl/include/internal/mm.h +++ b/ntoskrnl/include/internal/mm.h @@ -903,13 +903,6 @@ VOID NTAPI MmInitializeRmapList(VOID);
-VOID -NTAPI -MmSetCleanAllRmaps(PFN_NUMBER Page); -BOOLEAN -NTAPI -MmIsDirtyPageRmap(PFN_NUMBER Page); - NTSTATUS NTAPI MmPageOutPhysicalAddress(PFN_NUMBER Page); diff --git a/ntoskrnl/mm/rmap.c b/ntoskrnl/mm/rmap.c index 973b8342a5e..c680a8f7a9f 100644 --- a/ntoskrnl/mm/rmap.c +++ b/ntoskrnl/mm/rmap.c @@ -307,61 +307,6 @@ WriteSegment: return STATUS_UNSUCCESSFUL; }
-VOID -NTAPI -MmSetCleanAllRmaps(PFN_NUMBER Page) -{ - PMM_RMAP_ENTRY current_entry; - KIRQL OldIrql; - - OldIrql = MiAcquirePfnLock(); - current_entry = MmGetRmapListHeadPage(Page); - if (current_entry == NULL) - { - DPRINT1("MmSetCleanAllRmaps: No rmaps.\n"); - KeBugCheck(MEMORY_MANAGEMENT); - } - while (current_entry != NULL) - { - if (!RMAP_IS_SEGMENT(current_entry->Address)) - MmSetCleanPage(current_entry->Process, current_entry->Address); - current_entry = current_entry->Next; - } - MiReleasePfnLock(OldIrql); -} - -BOOLEAN -NTAPI -MmIsDirtyPageRmap(PFN_NUMBER Page) -{ - PMM_RMAP_ENTRY current_entry; - KIRQL OldIrql; - BOOLEAN Dirty = FALSE; - - OldIrql = MiAcquirePfnLock(); - current_entry = MmGetRmapListHeadPage(Page); - if (current_entry == NULL) - { - DPRINT1("MmIsDirtyPageRmap: No rmaps.\n"); - KeBugCheck(MEMORY_MANAGEMENT); - } - while (current_entry != NULL) - { - if (!RMAP_IS_SEGMENT(current_entry->Address)) - { - if (MmIsDirtyPage(current_entry->Process, current_entry->Address)) - { - Dirty = TRUE; - break; - } - } - current_entry = current_entry->Next; - } - MiReleasePfnLock(OldIrql); - - return Dirty; -} - VOID NTAPI MmInsertRmap(PFN_NUMBER Page, PEPROCESS Process, diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c index 88392afee7d..5df50f191ef 100644 --- a/ntoskrnl/mm/section.c +++ b/ntoskrnl/mm/section.c @@ -4848,9 +4848,6 @@ MmCheckDirtySegment( Entry = WRITE_SSE(Entry); MmSetPageEntrySectionSegment(Segment, Offset, Entry);
- /* Tell the other users that we are clean again */ - MmSetCleanAllRmaps(Page); - MmUnlockSectionSegment(Segment);
if (FlagOn(*Segment->Flags, MM_DATAFILE_SEGMENT)) @@ -4915,7 +4912,7 @@ MmCheckDirtySegment( else { /* Check if someone dirtified this page while we were not looking */ - DirtyAgain = IS_DIRTY_SSE(Entry) || MmIsDirtyPageRmap(Page); + DirtyAgain = IS_DIRTY_SSE(Entry); }
/* Drop the reference we got, deleting the write altogether. */