[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 2/2] Stop using contiguous memory for slabs


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Paul Durrant <paul.durrant@xxxxxxxxxx>
  • Date: Thu, 5 Sep 2019 16:25:13 +0100
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@xxxxxxxxxx; spf=Pass smtp.mailfrom=Paul.Durrant@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Paul Durrant <paul.durrant@xxxxxxxxxx>
  • Delivery-date: Thu, 05 Sep 2019 15:25:31 +0000
  • Ironport-sdr: b/lGFJa1waLHEo7NgD8SO3K+C8v1+58tP0TE6d+DzkS5J+vjGxA4ux7AlQwRp24JTSXIcFpl+v TNvGVWnYfqjarNnWE6MtfgmVL0ffYsq3FRn73HtAobvcdjiJEpOO07KiJTBByiMnhaDpuaCksL 4/wnDZQlUOS1evwyyJOs7zY9RNAYM0yp/GDMFeOs34lQ4u8ui1bPZkEiln0aOb2wQOS/NaZHsZ lB4syu9t8mmtg3FdTX4UxP6dL9ASqNbsY5+qX9kwWEhHQuHFE0Ut8sg452sr/3XTmMK62V5NGs lF8=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

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@xxxxxxxxxx>
---
 src/xenbus/cache.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

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
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.