mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-26 02:27:21 +03:00
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:
parent
937ca1db9f
commit
0043e68d4c
5 changed files with 23 additions and 17 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue