Author: arty
Date: Sun Dec 3 13:42:35 2006
New Revision: 25028
URL:
http://svn.reactos.org/svn/reactos?rev=25028&view=rev
Log:
Partially unregress python 2.4 installer.
Modified:
branches/arty-stable/reactos/ntoskrnl/cc/view.c
branches/arty-stable/reactos/ntoskrnl/mm/balance.c
branches/arty-stable/reactos/ntoskrnl/ps/process.c
Modified: branches/arty-stable/reactos/ntoskrnl/cc/view.c
URL:
http://svn.reactos.org/svn/reactos/branches/arty-stable/reactos/ntoskrnl/cc…
==============================================================================
--- branches/arty-stable/reactos/ntoskrnl/cc/view.c (original)
+++ branches/arty-stable/reactos/ntoskrnl/cc/view.c Sun Dec 3 13:42:35 2006
@@ -314,13 +314,11 @@
ULONG PagesPerSegment;
ULONG PagesFreed;
KIRQL oldIrql;
- LIST_ENTRY FreeList;
+ BOOLEAN Locked;
DPRINT("CcRosTrimCache(Target %d)\n", Target);
*NrFreed = 0;
-
- InitializeListHead(&FreeList);
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&ViewLock);
current_entry = CacheSegmentLRUListHead.Flink;
@@ -331,13 +329,15 @@
current_entry = current_entry->Flink;
KeAcquireSpinLock(¤t->Bcb->BcbLock, &oldIrql);
+ Locked = CcTryToAcquireBrokenMutex(¤t->Lock);
+ if (!Locked) continue;
+
if (current->ReferenceCount == 0)
{
RemoveEntryList(¤t->BcbSegmentListEntry);
KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql);
RemoveEntryList(¤t->CacheSegmentListEntry);
RemoveEntryList(¤t->CacheSegmentLRUListEntry);
- InsertHeadList(&FreeList, ¤t->BcbSegmentListEntry);
PagesPerSegment = current->Bcb->CacheSegmentSize / PAGE_SIZE;
PagesFreed = min(PagesPerSegment, Target);
Target -= PagesFreed;
@@ -350,9 +350,10 @@
ULONG i;
NTSTATUS Status;
- CcRosCacheSegmentIncRefCount(current);
+ CcRosCacheSegmentIncRefCount(current);
last = current;
current->PageOut = TRUE;
+ ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(¤t->Lock);
KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql);
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
for (i = 0; i < current->Bcb->CacheSegmentSize / PAGE_SIZE; i++)
@@ -375,16 +376,9 @@
}
KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql);
}
+ ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(¤t->Lock);
}
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
-
- while (!IsListEmpty(&FreeList))
- {
- current_entry = RemoveHeadList(&FreeList);
- current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
- BcbSegmentListEntry);
- CcRosInternalFreeCacheSegment(current);
- }
DPRINT("CcRosTrimCache() finished\n");
return(STATUS_SUCCESS);
@@ -680,7 +674,8 @@
KEBUGCHECKCC;
}
- current->BaseAddress = CiCacheSegMappingRegionBase + StartingOffset * PAGE_SIZE;
+ char *mapbase = CiCacheSegMappingRegionBase;
+ current->BaseAddress = mapbase + StartingOffset * PAGE_SIZE;
if (CiCacheSegMappingRegionHint == StartingOffset)
{
@@ -899,10 +894,12 @@
RegionSize = CacheSeg->Bcb->CacheSegmentSize / PAGE_SIZE;
/* Unmap all the pages. */
+ char *csbase = CacheSeg->BaseAddress, *mapbase = CiCacheSegMappingRegionBase;
+
for (i = 0; i < RegionSize; i++)
{
MmDeleteVirtualMapping(NULL,
- CacheSeg->BaseAddress + (i * PAGE_SIZE),
+ csbase + (i * PAGE_SIZE),
FALSE,
NULL,
&Page);
@@ -911,7 +908,7 @@
KeAcquireSpinLock(&CiCacheSegMappingRegionLock, &oldIrql);
/* Deallocate all the pages used. */
- Base = (ULONG)(CacheSeg->BaseAddress - CiCacheSegMappingRegionBase) / PAGE_SIZE;
+ Base = (ULONG)(csbase - mapbase) / PAGE_SIZE;
RtlClearBits(&CiCacheSegMappingRegionAllocMap, Base, RegionSize);
Modified: branches/arty-stable/reactos/ntoskrnl/mm/balance.c
URL:
http://svn.reactos.org/svn/reactos/branches/arty-stable/reactos/ntoskrnl/mm…
==============================================================================
--- branches/arty-stable/reactos/ntoskrnl/mm/balance.c (original)
+++ branches/arty-stable/reactos/ntoskrnl/mm/balance.c Sun Dec 3 13:42:35 2006
@@ -102,7 +102,7 @@
}
KeAcquireSpinLock(&AllocationListLock, &oldIrql);
- if (MmGetReferenceCountPage(Page) == 1)
+ if (MmGetReferenceCountPage(Page) > 0)
{
(void)InterlockedDecrementUL(&MiMemoryConsumers[Consumer].PagesUsed);
if (IsListEmpty(&AllocationListHead) || MmStats.NrFreePages <
MiMinimumAvailablePages)
@@ -139,7 +139,7 @@
MiMemoryConsumers[Consumer].PagesTarget;
if (Target < 1)
{
- Target = 1;
+ return;
}
if (MiMemoryConsumers[Consumer].Trim != NULL)
Modified: branches/arty-stable/reactos/ntoskrnl/ps/process.c
URL:
http://svn.reactos.org/svn/reactos/branches/arty-stable/reactos/ntoskrnl/ps…
==============================================================================
--- branches/arty-stable/reactos/ntoskrnl/ps/process.c (original)
+++ branches/arty-stable/reactos/ntoskrnl/ps/process.c Sun Dec 3 13:42:35 2006
@@ -560,6 +560,8 @@
/* Create or Clone the Handle Table */
ObpCreateHandleTable(Parent, Process);
+ memset(&Process->VadRoot, 0, sizeof(Process->VadRoot));
+
/* Set Process's Directory Base */
MmCopyMmInfo(Parent ? Parent : PsInitialSystemProcess,
Process,