[ros-diffs] [mbosma] 25345: Remove ShareCount member from page list. It has been added for the CC, but is not necessary. Rmaps are sufficient for checking how often a page is in use.

mbosma at svn.reactos.org mbosma at svn.reactos.org
Sun Jan 7 19:13:50 CET 2007


Author: mbosma
Date: Sun Jan  7 21:13:49 2007
New Revision: 25345

URL: http://svn.reactos.org/svn/reactos?rev=25345&view=rev
Log:
Remove ShareCount member from page list. It has been added for the CC, but is not necessary. Rmaps are sufficient for checking how often a page is in use. 

Modified:
    branches/cache_manager_rewrite/mm/freelist.c
    branches/cache_manager_rewrite/mm/rmap.c
    branches/cache_manager_rewrite/mm/section.c

Modified: branches/cache_manager_rewrite/mm/freelist.c
URL: http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/freelist.c?rev=25345&r1=25344&r2=25345&view=diff
==============================================================================
--- branches/cache_manager_rewrite/mm/freelist.c (original)
+++ branches/cache_manager_rewrite/mm/freelist.c Sun Jan  7 21:13:49 2007
@@ -45,7 +45,6 @@
    SWAPENTRY SavedSwapEntry;
    ULONG LockCount;
    ULONG MapCount;
-   ULONG ShareCount;
    struct _MM_RMAP_ENTRY* RmapListHead;
 }
 PHYSICAL_PAGE, *PPHYSICAL_PAGE;
@@ -78,7 +77,7 @@
    KeAcquireSpinLock(&PageListLock, &oldIrql);
    if (MmPageArray[Pfn].MapCount != 0)
    {
-      DbgPrint("Transfering mapped page.\n");
+      DPRINT1("Transfering mapped page.\n");
       KEBUGCHECK(0);
    }
    if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
@@ -408,7 +407,7 @@
 					          1);
          if (!NT_SUCCESS(Status))
          {
-            DbgPrint("Unable to create virtual mapping\n");
+            DPRINT1("Unable to create virtual mapping\n");
             KEBUGCHECK(0);
          }
       }
@@ -585,7 +584,7 @@
       KeAcquireSpinLock(&PageListLock, &oldIrql);
       if (MmPageArray[Pfn].Flags.Type == MM_PHYSICAL_PAGE_FREE)
       {
-         DbgPrint("Mapping non-used page\n");
+         DPRINT1("Mapping non-used page\n");
          KEBUGCHECK(0);
       }
       MmPageArray[Pfn].MapCount++;
@@ -604,12 +603,12 @@
       KeAcquireSpinLock(&PageListLock, &oldIrql);
       if (MmPageArray[Pfn].Flags.Type == MM_PHYSICAL_PAGE_FREE)
       {
-         DbgPrint("Unmapping non-used page\n");
+         DPRINT1("Unmapping non-used page\n");
          KEBUGCHECK(0);
       }
       if (MmPageArray[Pfn].MapCount == 0)
       {
-         DbgPrint("Unmapping not mapped page\n");
+         DPRINT1("Unmapping not mapped page\n");
          KEBUGCHECK(0);
       }
       MmPageArray[Pfn].MapCount--;
@@ -677,7 +676,7 @@
 
    if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
    {
-      DbgPrint("Referencing non-used page\n");
+      DPRINT1("Referencing non-used page\n");
       KEBUGCHECK(0);
    }
 
@@ -717,7 +716,7 @@
 
    if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
    {
-      DPRINT1("Getting reference count for free page (%x, %x)\n", Pfn, MmPageArray[Pfn].Flags.Type);
+      DPRINT1("Getting reference count for free page\n");
       KEBUGCHECK(0);
    }
 
@@ -765,12 +764,12 @@
 
    if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
    {
-      DbgPrint("Dereferencing free page\n");
+      DPRINT1("Dereferencing free page\n");
       KEBUGCHECK(0);
    }
    if (MmPageArray[Pfn].ReferenceCount == 0)
    {
-      DbgPrint("Derefrencing page with reference count 0\n");
+      DPRINT1("Derefrencing page with reference count 0\n");
       KEBUGCHECK(0);
    }
 
@@ -780,36 +779,30 @@
       MmStats.NrFreePages++;
       MmStats.NrSystemPages--;
       RemoveEntryList(&MmPageArray[Pfn].ListEntry);
-      if (MmPageArray[Pfn].ShareCount != 0)
-      {
-         DbgPrint("Freeing shared page (%x ShareCount %d)\n",
-	          Pfn << PAGE_SHIFT, MmPageArray[Pfn].ShareCount);
-	 KEBUGCHECK(0);
-      }
       if (MmPageArray[Pfn].RmapListHead != NULL)
       {
-         DbgPrint("Freeing page with rmap entries.\n");
+         DPRINT1("Freeing page with rmap entries.\n");
          KEBUGCHECK(0);
       }
       if (MmPageArray[Pfn].MapCount != 0)
       {
-         DbgPrint("Freeing mapped page (0x%x count %d)\n",
+         DPRINT1("Freeing mapped page (0x%x count %d)\n",
                   Pfn << PAGE_SHIFT, MmPageArray[Pfn].MapCount);
          KEBUGCHECK(0);
       }
       if (MmPageArray[Pfn].LockCount > 0)
       {
-         DbgPrint("Freeing locked page\n");
+         DPRINT1("Freeing locked page\n");
          KEBUGCHECK(0);
       }
       if (MmPageArray[Pfn].SavedSwapEntry != 0)
       {
-         DbgPrint("Freeing page with swap entry.\n");
+         DPRINT1("Freeing page with swap entry.\n");
          KEBUGCHECK(0);
       }
       if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
       {
-         DbgPrint("Freeing page with flags %x\n",
+         DPRINT1("Freeing page with flags %x\n",
                   MmPageArray[Pfn].Flags.Type);
          KEBUGCHECK(0);
       }
@@ -844,7 +837,7 @@
 
    if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
    {
-      DbgPrint("Getting lock count for free page\n");
+      DPRINT1("Getting lock count for free page\n");
       KEBUGCHECK(0);
    }
 
@@ -871,7 +864,7 @@
 
    if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
    {
-      DbgPrint("Locking free page\n");
+      DPRINT1("Locking free page\n");
       KEBUGCHECK(0);
    }
 
@@ -910,79 +903,12 @@
 
    if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
    {
-      DbgPrint("Unlocking free page\n");
+      DPRINT1("Unlocking free page\n");
       KEBUGCHECK(0);
    }
 
    MmPageArray[Pfn].LockCount--;
    KeReleaseSpinLock(&PageListLock, oldIrql);
-}
-
-ULONG
-MmSharePage(PFN_TYPE Pfn)
-{
-   KIRQL oldIrql;
-   ULONG ShareCount;
-
-   KeAcquireSpinLock(&PageListLock, &oldIrql);
-
-   if (Pfn >= MmPageArraySize)
-   {
-      DPRINT1("%x %x\n", Pfn, MmPageArraySize);
-      KEBUGCHECK(0);
-   }
-
-   if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
-     {
-	DPRINT1("Sharing free page %lx\n", Pfn);
-	KEBUGCHECK(0);
-     }
-   if (MmPageArray[Pfn].ShareCount == 0xffffffff)
-     {
-       DPRINT1("Maximum share count reached\n");
-       KEBUGCHECK(0);
-     }
-   MmPageArray[Pfn].ShareCount++;
-   ShareCount = MmPageArray[Pfn].ShareCount;
-   KeReleaseSpinLock(&PageListLock, oldIrql);
-   return ShareCount;
-}
-
-ULONG
-MmUnsharePage(PFN_TYPE Pfn)
-{
-   KIRQL oldIrql;
-   ULONG ShareCount;
-
-   KeAcquireSpinLock(&PageListLock, &oldIrql);
-
-   if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED)
-     {
-	DbgPrint("Unsharing free page\n");
-	KEBUGCHECK(0);
-     }
-
-   if (MmPageArray[Pfn].ShareCount == 0)
-     {
-       DbgPrint("Unsharing not shared page\n");
-       KEBUGCHECK(0);
-     }
-   MmPageArray[Pfn].ShareCount--;
-   ShareCount = MmPageArray[Pfn].ShareCount;
-   KeReleaseSpinLock(&PageListLock, oldIrql);
-   return ShareCount;
-}
-
-ULONG
-MmGetShareCountPage(PFN_TYPE Pfn)
-{
-   return MmPageArray[Pfn].ShareCount;
-}
-
-ULONG 
-MmGetMemoryConsumerPage(PFN_TYPE Pfn)
-{
-	return MmPageArray[Pfn].Flags.Consumer;
 }
 
 PFN_TYPE
@@ -1022,12 +948,12 @@
 
    if (PageDescriptor->Flags.Type != MM_PHYSICAL_PAGE_FREE)
    {
-      DbgPrint("Got non-free page from freelist\n");
+      DPRINT1("Got non-free page from freelist\n");
       KEBUGCHECK(0);
    }
    if (PageDescriptor->MapCount != 0)
    {
-      DbgPrint("Got mapped page from freelist\n");
+      DPRINT1("Got mapped page from freelist\n");
       KEBUGCHECK(0);
    }
    if (PageDescriptor->ReferenceCount != 0)
@@ -1040,7 +966,6 @@
    PageDescriptor->ReferenceCount = 1;
    PageDescriptor->LockCount = 0;
    PageDescriptor->MapCount = 0;
-   PageDescriptor->ShareCount = 0;
    PageDescriptor->SavedSwapEntry = SavedSwapEntry;
    InsertTailList(&UsedPageListHeads[Consumer], ListEntry);
 
@@ -1056,7 +981,7 @@
    }
    if (PageDescriptor->MapCount != 0)
    {
-      DbgPrint("Returning mapped page.\n");
+      DPRINT1("Returning mapped page.\n");
       KEBUGCHECK(0);
    }
    return PfnOffset;
@@ -1141,7 +1066,6 @@
          PageDescriptor->ReferenceCount = 1;
          PageDescriptor->LockCount = 0;
          PageDescriptor->MapCount = 0;
-	 PageDescriptor->ShareCount = 0;
          PageDescriptor->SavedSwapEntry = 0; /* FIXME: Do we need swap entries? */
          InsertTailList(&UsedPageListHeads[Consumer], &PageDescriptor->ListEntry);
 
@@ -1176,7 +1100,6 @@
             PageDescriptor->ReferenceCount = 1;
             PageDescriptor->LockCount = 0;
             PageDescriptor->MapCount = 0;
-	    PageDescriptor->ShareCount = 0;
             PageDescriptor->SavedSwapEntry = 0; /* FIXME: Do we need swap entries? */
             RemoveEntryList(&PageDescriptor->ListEntry);
             InsertTailList(&UsedPageListHeads[Consumer], &PageDescriptor->ListEntry);
@@ -1241,13 +1164,13 @@
                                      NULL);
       if (!NT_SUCCESS(Status))
       {
-         DbgPrint("ZeroPageThread: Wait failed\n");
+         DPRINT1("ZeroPageThread: Wait failed\n");
          KEBUGCHECK(0);
       }
 
       if (ZeroPageThreadShouldTerminate)
       {
-         DbgPrint("ZeroPageThread: Terminating\n");
+         DPRINT1("ZeroPageThread: Terminating\n");
          return STATUS_SUCCESS;
       }
       Count = 0;
@@ -1266,7 +1189,7 @@
          KeAcquireSpinLock(&PageListLock, &oldIrql);
          if (PageDescriptor->MapCount != 0)
          {
-            DbgPrint("Mapped page on freelist.\n");
+            DPRINT1("Mapped page on freelist.\n");
             KEBUGCHECK(0);
          }
 	 PageDescriptor->Flags.Zero = 1;

Modified: branches/cache_manager_rewrite/mm/rmap.c
URL: http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/rmap.c?rev=25345&r1=25344&r2=25345&view=diff
==============================================================================
--- branches/cache_manager_rewrite/mm/rmap.c (original)
+++ branches/cache_manager_rewrite/mm/rmap.c Sun Jan  7 21:13:49 2007
@@ -308,7 +308,6 @@
         */ 
         MmDeleteVirtualMapping(AddressSpace->Process, (PVOID)Address, FALSE, NULL, NULL);
         MmUnlockAddressSpace(AddressSpace);
-        // FIXME Comment out for now // while(MmUnsharePage(Page));
         MmDeleteAllRmaps(Page, NULL, NULL);
         MmReleasePageMemoryConsumer(MC_CACHE, Page);
    }
@@ -363,6 +362,26 @@
       current_entry = current_entry->Next;
    }
    ExReleaseFastMutex(&RmapListLock);
+}
+
+ULONG
+NTAPI
+MmGetRmapCount(PFN_TYPE Page)
+{
+   ULONG Count = 0;
+   PMM_RMAP_ENTRY current_entry;
+
+   ExAcquireFastMutex(&RmapListLock);
+   current_entry = MmGetRmapListHeadPage(Page);
+
+   while (current_entry)
+   {
+      Count++;
+      current_entry = current_entry->Next;
+   }
+   ExReleaseFastMutex(&RmapListLock);
+
+   return Count;
 }
 
 BOOLEAN

Modified: branches/cache_manager_rewrite/mm/section.c
URL: http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/section.c?rev=25345&r1=25344&r2=25345&view=diff
==============================================================================
--- branches/cache_manager_rewrite/mm/section.c (original)
+++ branches/cache_manager_rewrite/mm/section.c Sun Jan  7 21:13:49 2007
@@ -115,15 +115,6 @@
 
 /* FUNCTIONS *****************************************************************/
 
-ULONG
-MmSharePage(PFN_TYPE Pfn);
-
-ULONG
-MmUnsharePage(PFN_TYPE Pfn);
-
-ULONG
-MmGetShareCountPage(PFN_TYPE Pfn);
-
 ULONG 
 MmGetMemoryConsumerPage (PFN_TYPE Pfn);
 
@@ -285,9 +276,8 @@
                {
                   KEBUGCHECK(0);
                }
-               else if (MmGetShareCountPage(PFN_FROM_SSE(Entry)) != 0)
+               else if (MmGetRmapListHeadPage(PFN_FROM_SSE(Entry)))
                {
-                  DPRINT1("%d %x\n", i, Offset, MmGetShareCountPage(PFN_FROM_SSE(Entry)));
                   KEBUGCHECK(0);
                }
                else
@@ -387,9 +377,8 @@
             {
                KEBUGCHECK(0);
             }
-            else if (MmGetShareCountPage(PFN_FROM_SSE(Entry)) != 0)
+            else if (MmGetRmapListHeadPage(PFN_FROM_SSE(Entry)))
             {
-               DPRINT1("%d %x\n", Offset, MmGetShareCountPage(PFN_FROM_SSE(Entry)));
                KEBUGCHECK(0);
             }
             else
@@ -605,26 +594,6 @@
    return(Entry);
 }
 
-VOID
-NTAPI
-MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
-                               ULONG Offset)
-{
-   ULONG Entry;
-
-   Entry = MmGetPageEntrySectionSegment(Segment, Offset);
-   if (Entry == 0)
-   {
-      DPRINT1("Entry == 0 for MmSharePageEntrySectionSegment\n");
-      KEBUGCHECK(0);
-   }
-   if (IS_SWAP_FROM_SSE(Entry))
-   {
-      KEBUGCHECK(0);
-   }
-   MmSharePage(PFN_FROM_SSE(Entry));
-}
-
 BOOLEAN
 NTAPI
 MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
@@ -634,9 +603,9 @@
                                  BOOLEAN PageOut)
 {
    ULONG Entry;
-   ULONG ShareCount;
    ULONG Consumer;
    PFN_TYPE Page;
+   BOOLEAN LastReference;
 
    Entry = MmGetPageEntrySectionSegment(Segment, Offset);
    if (Entry == 0)
@@ -654,7 +623,8 @@
     * If we reducing the share count of this entry to zero then set the entry
     * to zero and tell the cache the page is no longer mapped.
     */
-   if ((ShareCount = MmUnsharePage(Page)) == 0)
+   LastReference = (MmGetRmapListHeadPage(Page) == NULL);
+   if (LastReference)
    {
       PFILE_OBJECT FileObject;
       SWAPENTRY SavedSwapEntry;
@@ -810,7 +780,7 @@
          MmSetPageEntrySectionSegment(Segment, Offset, Entry | 0x2);
       }
    }
-   return (ShareCount > 0);
+   return (LastReference);
 }
 
 VOID
@@ -1184,8 +1154,6 @@
             return(STATUS_MM_RESTART_OPERATION);
          }
 
-         MmSharePageEntrySectionSegment(Segment, SegmentOffset);
-
          /* FIXME: Should we call MmCreateVirtualMappingUnsafe if
           * (Section->AllocationAttributes & SEC_PHYSICALMEMORY) is true?
           */
@@ -1438,7 +1406,6 @@
           * data
           */
          Entry = MAKE_SSE(Pfn[i] << PAGE_SHIFT, 0);
-         MmSharePage(Pfn[i]);
          MmSetPageEntrySectionSegment(Segment, SegmentOffset + i * PAGE_SIZE, Entry);
       }
       Status = MmCreateVirtualMapping(AddressSpace->Process,
@@ -1446,7 +1413,6 @@
                                       Attributes,
                                       Pfn,
                                       PageCount);
-      MmUnlockSectionSegment(Segment);
 
       if (!NT_SUCCESS(Status))
       {
@@ -1457,6 +1423,8 @@
       {
          MmInsertRmap(Pfn[i], AddressSpace->Process, (PVOID)((ULONG_PTR)PAddress + i * PAGE_SIZE));
       }
+
+      MmUnlockSectionSegment(Segment);
 
       if (Locked)
       {
@@ -1517,9 +1485,7 @@
        * data
        */
       Entry = MAKE_SSE(Pfn[0] << PAGE_SHIFT, 0);
-      MmSharePage(Pfn[0]);
       MmSetPageEntrySectionSegment(Segment, SegmentOffset, Entry);
-      MmUnlockSectionSegment(Segment);
 
       /*
        * Save the swap entry.
@@ -1537,6 +1503,8 @@
          return(Status);
       }
       MmInsertRmap(Pfn[0], AddressSpace->Process, (PVOID)PAddress);
+      MmUnlockSectionSegment(Segment);
+
       if (Locked)
       {
          MmLockPage(Pfn[0]);
@@ -1554,9 +1522,6 @@
        */
 
       Pfn[0] = PFN_FROM_SSE(Entry);
-
-      MmSharePageEntrySectionSegment(Segment, SegmentOffset);
-      MmUnlockSectionSegment(Segment);
 
       Status = MmCreateVirtualMapping(AddressSpace->Process,
                                       Address,
@@ -1573,6 +1538,8 @@
       {
          MmLockPage(Pfn[0]);
       }
+
+      MmUnlockSectionSegment(Segment);
       PageOp[0]->Status = STATUS_SUCCESS;
       MmspCompleteAndReleasePageOp(PageOp[0]);
       DPRINT("Address 0x%.8X\n", Address);
@@ -1731,7 +1698,6 @@
             KEBUGCHECK(0);
          }
 
-         MmSharePageEntrySectionSegment(Segment, Offset);
          Status = MmCreateVirtualMapping(AddressSpace->Process,
                                          Address,
                                          Attributes,
@@ -1844,7 +1810,6 @@
           */
          Entry = MAKE_SSE(Pfn[i] << PAGE_SHIFT, 0);
          ASSERT (Entry);
-         MmSharePage(Pfn[i]);
          MmSetPageEntrySectionSegment(Segment, Offset + i * PAGE_SIZE, Entry);
       }
       Status = MmCreateVirtualMapping(AddressSpace->Process,
@@ -1852,7 +1817,6 @@
                                       Attributes,
                                       Pfn,
                                       PageCount);
-      MmUnlockSectionSegment(Segment);
 
       if (!NT_SUCCESS(Status))
       {
@@ -1870,6 +1834,7 @@
          MmspCompleteAndReleasePageOp(PageOp[i]);
       }
       DPRINT("Address 0x%.8X\n", Address);
+      MmUnlockSectionSegment(Segment);
       return(STATUS_SUCCESS);
    }
    else
@@ -1881,8 +1846,6 @@
 
       Pfn[0] = PFN_FROM_SSE(Entry);
 
-      MmSharePageEntrySectionSegment(Segment, Offset);
-      MmUnlockSectionSegment(Segment);
       Status = MmCreateVirtualMapping(AddressSpace->Process,
                                       PAddress,
                                       Attributes,
@@ -1898,6 +1861,7 @@
       {
          MmLockPage(Pfn[0]);
       }
+      MmUnlockSectionSegment(Segment);
       PageOp[0]->Status = STATUS_SUCCESS;
       MmspCompleteAndReleasePageOp(PageOp[0]);
       DPRINT("Address 0x%.8X\n", Address);
@@ -2029,8 +1993,6 @@
 
          Page = PFN_FROM_SSE(Entry);
 
-         MmSharePageEntrySectionSegment(Segment, Offset);
-
          Status = MmCreateVirtualMapping(AddressSpace->Process,
                                          Address,
                                          Attributes,
@@ -2107,10 +2069,7 @@
        */
       Entry = MAKE_SSE(Page << PAGE_SHIFT, 0);
       DPRINT("%x\n", Page);
-      MmSharePage(Page);
       MmSetPageEntrySectionSegment(Segment, Offset, Entry);
-      MmUnlockSectionSegment(Segment);
-
       Status = MmCreateVirtualMapping(AddressSpace->Process,
                                       PAddress,
                                       Attributes,
@@ -2122,6 +2081,7 @@
          KEBUGCHECK(0);
       }
       MmInsertRmap(Page, AddressSpace->Process, (PVOID)PAddress);
+      MmUnlockSectionSegment(Segment);
 
       if (Locked)
       {
@@ -2179,9 +2139,7 @@
        * data
        */
       Entry = MAKE_SSE(Page << PAGE_SHIFT, 0);
-      MmSharePage(Page);
       MmSetPageEntrySectionSegment(Segment, Offset, Entry);
-      MmUnlockSectionSegment(Segment);
 
       /*
        * Save the swap entry.
@@ -2202,6 +2160,7 @@
       {
          MmLockPage(Page);
       }
+      MmUnlockSectionSegment(Segment);
       PageOp->Status = STATUS_SUCCESS;
       MmspCompleteAndReleasePageOp(PageOp);
       DPRINT("Address 0x%.8X\n", Address);
@@ -2216,8 +2175,6 @@
 
       Page = PFN_FROM_SSE(Entry);
 
-      MmSharePageEntrySectionSegment(Segment, Offset);
-      MmUnlockSectionSegment(Segment);
 
       Status = MmCreateVirtualMapping(AddressSpace->Process,
                                       PAddress,
@@ -2234,6 +2191,7 @@
       {
          MmLockPage(Page);
       }
+      MmUnlockSectionSegment(Segment);
       PageOp->Status = STATUS_SUCCESS;
       MmspCompleteAndReleasePageOp(PageOp);
       DPRINT("Address 0x%.8X\n", Address);
@@ -2724,7 +2682,6 @@
                          AddressSpace->Process,
                          Address);
             Entry = MAKE_SSE(Page << PAGE_SHIFT, 0);
-            MmSharePage(Page);
             MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry);
          }
          MmUnlockAddressSpace(AddressSpace);
@@ -2771,7 +2728,6 @@
                       AddressSpace->Process,
                       Address);
          Entry = MAKE_SSE(Page << PAGE_SHIFT, 0);
-         MmSharePage(Page);
          MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry);
       }
       MmUnlockAddressSpace(AddressSpace);
@@ -5403,7 +5359,6 @@
    ULONG Length;
    ULONG Entry;
    PFN_TYPE Pfn;
-   ULONG ShareCount;
 
    DPRINT("MmChangeSectionSize\n");
 
@@ -5445,10 +5400,9 @@
             else
             {
                Pfn = PFN_FROM_SSE(Entry);
-               if (0 != (ShareCount = MmGetShareCountPage(Pfn)))
+               if (MmGetRmapListHeadPage(PFN_FROM_SSE(Entry)))
                {
                   /* page is mapped */
-                  DPRINT1("%d\n", ShareCount);
                   KEBUGCHECK(0);
                }
                else
@@ -6227,9 +6181,8 @@
                      {
                         KEBUGCHECK(0);
                      }
-                     else if (MmGetShareCountPage(PFN_FROM_SSE(Entry)) != 0)
+                     else if (MmGetRmapListHeadPage(PFN_FROM_SSE(Entry)))
                      {
-                        DPRINT1("%d %x\n", i, Offset, MmGetShareCountPage(PFN_FROM_SSE(Entry)));
                         KEBUGCHECK(0);
                      }
                      else
@@ -6283,7 +6236,7 @@
    Entry = MmGetPageEntrySectionSegment(Segment, Offset);
    Pfn = PFN_FROM_SSE(Entry);
 
-   if (MmGetShareCountPage(Pfn))
+   if (MmGetRmapListHeadPage(Pfn))
    {
       MmSetCleanAllRmaps(Pfn);
    }
@@ -6354,7 +6307,7 @@
 
       Pfn[i] = PFN_FROM_SSE(Entry);
       MmSetPageEntrySectionSegment(((PPAGE_IO_CONTEXT)Context)->Segment, Offset, Entry & ~0x2);
-      if (MmGetShareCountPage(Pfn[i]))
+      if (MmGetRmapListHeadPage(Pfn[i]))
       {
          MmSetCleanAllRmaps(Pfn[i]);
       }
@@ -6433,7 +6386,7 @@
             Entry = MmGetPageEntrySectionSegment(current, i * PAGE_SIZE);
             Pfn = PFN_FROM_SSE(Entry);
 
-            if (!IS_SWAP_FROM_SSE(Entry) && Pfn && !(Entry & 0x2) && MmGetShareCountPage(Pfn) && MmIsDirtyPageRmap(Pfn))
+            if (!IS_SWAP_FROM_SSE(Entry) && Pfn && !(Entry & 0x2) && MmGetRmapListHeadPage(Pfn) && MmIsDirtyPageRmap(Pfn))
             {
                Entry |= 0x2;
                MmSetPageEntrySectionSegment(current, i * PAGE_SIZE, Entry);
@@ -6594,7 +6547,7 @@
    {
        Entry = MmGetPageEntrySectionSegment(Segment, i * PAGE_SIZE);
        Pfn = PFN_FROM_SSE(Entry);
-       if (!IS_SWAP_FROM_SSE(Entry) && Pfn && !(Entry & 0x2) && MmGetShareCountPage(Pfn) && MmIsDirtyPageRmap(Pfn))
+       if (!IS_SWAP_FROM_SSE(Entry) && Pfn && !(Entry & 0x2) && MmGetRmapListHeadPage(Pfn) && MmIsDirtyPageRmap(Pfn))
        {
           Entry|=0x2;
           MmSetPageEntrySectionSegment(Segment, i * PAGE_SIZE, Entry);
@@ -6653,7 +6606,7 @@
    for (i = Offset.u.LowPart / PAGE_SIZE; i < Length/PAGE_SIZE; i++)
    {
       Entry = MmGetPageEntrySectionSegment(Segment, i * PAGE_SIZE);
-      if(Entry && MmGetShareCountPage(PFN_FROM_SSE(Entry)) == 0)
+      if(Entry && MmGetRmapListHeadPage(PFN_FROM_SSE(Entry)) == 0)
       {
          MmSetPageEntrySectionSegment(Segment, i * PAGE_SIZE, 0);
          MmReleasePageMemoryConsumer(MC_CACHE, PFN_FROM_SSE(Entry));




More information about the Ros-diffs mailing list