Track low_water == -1 case explicitly.
The -1 value of low_water indicates if the cache has been depleted and refilled. Track the status explicitly in the tcache struct. This allows the fast path to check if (cur_ptr > low_water), instead of >=, which avoids reaching slow path when the last item is allocated.
This commit is contained in:
@@ -23,7 +23,7 @@ TEST_BEGIN(test_cache_bin) {
|
||||
bool success;
|
||||
void *ret = cache_bin_alloc_easy(bin, &success, 0);
|
||||
assert_false(success, "Empty cache bin should not alloc");
|
||||
assert_true(cache_bin_low_water_get(bin, 0) == - 1,
|
||||
assert_true(cache_bin_low_water_get(bin, 0) == 0,
|
||||
"Incorrect low water mark");
|
||||
|
||||
cache_bin_ncached_set(bin, 0, 0);
|
||||
|
Reference in New Issue
Block a user