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

[PATCH 3/3] Remove MINIMUM_OBJECT_SIZE


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Mon, 19 Jul 2021 11:03:34 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Mon, 19 Jul 2021 10:05:48 +0000
  • Ironport-hdrordr: A9a23:zOeir6N/+MYGWMBcTlejsMiBIKoaSvp037By7TEJdfUnSL3hqy nOpoVu6faaskd1ZJhNo7690ey7MBXhHP1OkP4s1NWZLW3bUQKTRekIh+aPrAEIWReOkdK1vp 0BT0EKMqyTMbEMt7eY3ODXKbcdKZK8gduVbK/lvg1QpNZRGtddBilCe3um+hcafng7OXIbea Dsmfau51ebCAUqhorXPAh0YwCMzee74a4P03M9dmAawRjLkDeh8rK/CBSDwhICOgk/sosK4C zZlwTi6uG9v+qgyhnavlWjnahrpA==
  • Ironport-sdr: dmqKzypxW/0kPTvkFJgyeTYPns+7S6QcM1x4y6VDrLgwd06z4t59rVnAFa1y+xju45UYFX4p8v hA92rJWOzMIFEsUSsXpPpM+q9jSZ0j5H93bAFajnhxTHRTXYuDD9oV1Fh5Jza0LJk7XNzHm46X 51R+1tC3JspJ7Kuq9JKWPu/0NH1LkunWxx8xSYWKFsbZVYUK6bphG1HPkby6isC7Ro/INg+oOn mLPXs9blSn1bNcpyHgYwg3h263txsEz8J0A5rcJoGLrbMcv3+Dv0B4ambfqYCjSdVC4J+BLkEu +KfpXEdlTmu7Q+upExDnIB+6
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

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.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 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)
-- 
2.31.1.windows.1




 


Rackspace

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