]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Stop using contiguous memory for slabs
authorPaul Durrant <paul.durrant@citrix.com>
Thu, 5 Sep 2019 15:21:55 +0000 (16:21 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Thu, 5 Sep 2019 15:21:55 +0000 (16:21 +0100)
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 <paul.durrant@citrix.com>
src/xenbus/cache.c

index 1c1f4c4f033a72bc3b73dcf592567bdf7a0d357e..ba0177b71223d654f23f7b108cd2bf6acee931c4 100644 (file)
@@ -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