Author: fireball
Date: Thu Mar 13 15:14:30 2008
New Revision: 32675
URL: http://svn.reactos.org/svn/reactos?rev=3D32675&view=3Drev
Log:
- Switch to using the cache bitmap (the cache manager uses one large memory=
region within the kernel address space and allocate/deallocate space from =
this block over a bitmap).
- This removes (hides?) the so-called "ResourceNeverExclusive" problem at t=
he end of the 1st stage setup or during file copy operation. Also it makes =
file copying process (not only in the 1st stage) more stable.
- Cacheseg mapping region size enlarged to 256Mb.
See issue #2872 for more details.
Modified:
trunk/reactos/ntoskrnl/cc/view.c
Modified: trunk/reactos/ntoskrnl/cc/view.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/view.c?re=
v=3D32675&r1=3D32674&r2=3D32675&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/cc/view.c (original)
+++ trunk/reactos/ntoskrnl/cc/view.c Thu Mar 13 15:14:30 2008
@@ -47,7 +47,7 @@
* over a bitmap. If CACHE_BITMAP is used, the size of the mdl mapping reg=
ion
* must be reduced (ntoskrnl\mm\mdl.c, MI_MDLMAPPING_REGION_SIZE).
*/
-//#define CACHE_BITMAP
+#define CACHE_BITMAP
=
static LIST_ENTRY DirtySegmentListHead;
static LIST_ENTRY CacheSegmentListHead;
@@ -58,7 +58,7 @@
KGUARDED_MUTEX ViewLock;
=
#ifdef CACHE_BITMAP
-#define CI_CACHESEG_MAPPING_REGION_SIZE (128*1024*1024)
+#define CI_CACHESEG_MAPPING_REGION_SIZE (256*1024*1024)
=
static PVOID CiCacheSegMappingRegionBase =3D NULL;
static RTL_BITMAP CiCacheSegMappingRegionAllocMap;
@@ -564,10 +564,12 @@
PCACHE_SEGMENT current;
PCACHE_SEGMENT previous;
PLIST_ENTRY current_entry;
- NTSTATUS Status;
KIRQL oldIrql;
#ifdef CACHE_BITMAP
ULONG StartingOffset;
+#else
+ ULONG_PTR GuardArea;
+ NTSTATUS Status;
#endif
PHYSICAL_ADDRESS BoundaryAddressMultiple;
=
@@ -677,7 +679,8 @@
KEBUGCHECKCC;
}
=
- current->BaseAddress =3D CiCacheSegMappingRegionBase + StartingOffset * =
PAGE_SIZE;
+ current->BaseAddress =3D (PVOID)((ULONG_PTR)CiCacheSegMappingRegionBase +
+ StartingOffset * PAGE_SIZE);
=
if (CiCacheSegMappingRegionHint =3D=3D StartingOffset)
{
@@ -886,7 +889,7 @@
for (i =3D 0; i < RegionSize; i++)
{
MmDeleteVirtualMapping(NULL,
- CacheSeg->BaseAddress + (i * PAGE_SIZE),
+ (PVOID)((ULONG_PTR)CacheSeg->BaseAddress + (i * PAGE_SIZE)),
FALSE,
NULL,
&Page);
@@ -895,7 +898,8 @@
=
KeAcquireSpinLock(&CiCacheSegMappingRegionLock, &oldIrql);
/* Deallocate all the pages used. */
- Base =3D (ULONG)(CacheSeg->BaseAddress - CiCacheSegMappingRegionBase) / =
PAGE_SIZE;
+ Base =3D ((ULONG_PTR)CacheSeg->BaseAddress -
+ (ULONG_PTR)CiCacheSegMappingRegionBase) / PAGE_SIZE;
=
RtlClearBits(&CiCacheSegMappingRegionAllocMap, Base, RegionSize);
=