- 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 the 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.

svn path=/trunk/; revision=32675
This commit is contained in:
Aleksey Bragin 2008-03-13 20:14:30 +00:00
parent 362ca1e480
commit 0d99c97ab4

View file

@ -47,7 +47,7 @@
* over a bitmap. If CACHE_BITMAP is used, the size of the mdl mapping region
* 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 @@ ULONG DirtyPageCount=0;
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 = NULL;
static RTL_BITMAP CiCacheSegMappingRegionAllocMap;
@ -564,10 +564,12 @@ CcRosCreateCacheSegment(PBCB Bcb,
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 @@ CcRosCreateCacheSegment(PBCB Bcb,
KEBUGCHECKCC;
}
current->BaseAddress = CiCacheSegMappingRegionBase + StartingOffset * PAGE_SIZE;
current->BaseAddress = (PVOID)((ULONG_PTR)CiCacheSegMappingRegionBase +
StartingOffset * PAGE_SIZE);
if (CiCacheSegMappingRegionHint == StartingOffset)
{
@ -886,7 +889,7 @@ CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg)
for (i = 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 @@ CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg)
KeAcquireSpinLock(&CiCacheSegMappingRegionLock, &oldIrql);
/* Deallocate all the pages used. */
Base = (ULONG)(CacheSeg->BaseAddress - CiCacheSegMappingRegionBase) / PAGE_SIZE;
Base = ((ULONG_PTR)CacheSeg->BaseAddress -
(ULONG_PTR)CiCacheSegMappingRegionBase) / PAGE_SIZE;
RtlClearBits(&CiCacheSegMappingRegionAllocMap, Base, RegionSize);