From: Paul Durrant Date: Thu, 5 Sep 2019 15:21:55 +0000 (+0100) Subject: Stop using contiguous memory for slabs X-Git-Tag: 9.0.0-rc1~13 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=202934a2141cd80a0cd799a3a29ce8099cb6900b;p=pvdrivers%2Fwin%2Fxenbus.git Stop using contiguous memory for slabs Slab memory does not need to be (physically) contiguous and it is much faster to use non-paged pool memory, so just used __CacheAllocate/Free() for slab memory as well as internal house-keeping structures. Signed-off-by: Paul Durrant --- diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c index 1c1f4c4..ba0177b 100644 --- a/src/xenbus/cache.c +++ b/src/xenbus/cache.c @@ -294,9 +294,6 @@ CacheCreateSlab( PXENBUS_CACHE_SLAB Slab; ULONG NumberOfBytes; ULONG Count; - LARGE_INTEGER LowAddress; - LARGE_INTEGER HighAddress; - LARGE_INTEGER Boundary; ULONG Size; LONG Index; NTSTATUS status; @@ -312,16 +309,8 @@ CacheCreateSlab( if (Cache->Count + Count > Cache->Cap) goto fail1; - LowAddress.QuadPart = 0ull; - HighAddress.QuadPart = ~0ull; - Boundary.QuadPart = 0ull; - - Slab = MmAllocateContiguousMemorySpecifyCacheNode((SIZE_T)NumberOfBytes, - LowAddress, - HighAddress, - Boundary, - MmCached, - MM_ANY_NODE_OK); + Slab = __CacheAllocate(NumberOfBytes); + ASSERT3P(Slab, ==, PAGE_ALIGN(Slab)); status = STATUS_NO_MEMORY; if (Slab == NULL) @@ -367,7 +356,7 @@ fail4: fail3: Error("fail3\n"); - MmFreeContiguousMemory(Slab); + __CacheFree(Slab); fail2: Error("fail2\n"); @@ -412,8 +401,7 @@ CacheDestroySlab( } __CacheFree(Slab->Mask); - - MmFreeContiguousMemory(Slab); + __CacheFree(Slab); } static FORCEINLINE ULONG