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

Re: [PATCH 3/3] Allow removal of current Slab



On 07/06/2023 12:53, Owen Smith wrote:
Then it looks like a minor reordering is needed. The check for CacheMaskCount(Slab) == CacheMaskSize(Slab) should be made before the attempt to call CacheGetObjectFromSlab(Slab), as if Slab is full, CacheGetObjectFromSlab will fail and return NULL, triggering the ASSERT
i.e.
if (Cache->Cursor != &Cache->SlabList) {
   PLIST_ENTRY ListEntry = Cache->Cursor;
   PXENBUS_CACHE_SLAB Slab;
   Slab = CONTAINING_RECORD(ListEntry, XENBUS_CACHE_SLAB, ListEntry);
   if (CacheMaskCount(Slab->Allocated) == CacheMaskSize(Slab->Allocated)) {
     // this slab is full, try next slab
     Cache->Cursor = Slab->ListEntry.Flink;
     goto again;
   }
   // there are free objects in this slab, this should always work
   Object = CacheGetObjectFromSlab(Slab);
   ASSERT(Object != NULL);
}

[snip]

The question is why can we end up with Cache->Cursor != &Cache->SlabList, but yet the slab is full? This is not a valid state for the cache to be in.

  Paul





 


Rackspace

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