Make threshold for waking always a percentage

The threshold for waking is used to ensure that we only use a slab when
it has sufficient space that we won't hit the slow path to soon after
using this slab. In the checked version, this is also used to give some
entropy in layout.  Changing this to always be a pertcentage in the
checked case increases the effectiveness of the free list to detect OOB
write.
This commit is contained in:
Matthew Parkinson
2021-08-13 12:04:19 +01:00
committed by Matthew Parkinson
parent caaa1b5de6
commit f38a5a63d5

View File

@@ -100,7 +100,11 @@ namespace snmalloc
static_cast<uint16_t>((slab_mask[sizeclass] + 1) / rsize);
waking[sizeclass] =
#ifdef SNMALLOC_CHECK_CLIENT
static_cast<uint16_t>(capacity[sizeclass] / 4);
#else
static_cast<uint16_t>(bits::min((capacity[sizeclass] / 4), 32));
#endif
}
for (sizeclass_compress_t sizeclass = NUM_SIZECLASSES;