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

Re: [PATCH 3/3] Remove MINIMUM_OBJECT_SIZE


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Paul Durrant <xadimgnik@xxxxxxxxx>
  • Date: Mon, 19 Jul 2021 11:57:00 +0100
  • Delivery-date: Mon, 19 Jul 2021 10:57:04 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

On 19/07/2021 11:03, Owen Smith wrote:
MINIMUM_OBJECT_SIZE would make all cached objects at least 0x80 bytes, which
would limit the number of objects in each slab to 31 objects.

This limitation is not needed, as the slab's mask is dynamically allocated to
cope with the correct number of objects that can fit into a single slab.
Cache object's sizes are rounded up to the nearest pointer boundary to maintain
object alignment. Removing the minimum size allows more objects per cache slab,
reducing the memory overhead of caches.


Yes, that restriction dates from a time when the slab mask was inline.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

Acked-by: Paul Durrant <paul@xxxxxxx>

---
  src/xenbus/cache.c | 9 ++-------
  1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index d695ee3..a24c4e5 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -66,12 +66,8 @@ typedef struct _XENBUS_CACHE_SLAB {
      UCHAR           Buffer[1];
  } XENBUS_CACHE_SLAB, *PXENBUS_CACHE_SLAB;
-#define BITS_PER_ULONG (sizeof (ULONG) * 8)
-#define MINIMUM_OBJECT_SIZE (PAGE_SIZE / BITS_PER_ULONG)
-
-C_ASSERT(sizeof (XENBUS_CACHE_SLAB) <= MINIMUM_OBJECT_SIZE);
-
-#define MAXNAMELEN  128
+#define BITS_PER_ULONG  (sizeof (ULONG) * 8)
+#define MAXNAMELEN      128
struct _XENBUS_CACHE {
      LIST_ENTRY              ListEntry;
@@ -806,7 +802,6 @@ CacheCreate(
      if (!NT_SUCCESS(status))
          goto fail2;
- Size = __max(Size, MINIMUM_OBJECT_SIZE);
      Size = P2ROUNDUP(Size, sizeof (ULONG_PTR));
if (Cap == 0)





 


Rackspace

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