From 26941e02aa4fb293e8e213dfb438466a95f1c67c Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Tue, 27 Dec 2016 12:12:33 -0800 Subject: [PATCH] Attempt to free up to 20% of the plasma store capacity during eviction. (#159) --- src/plasma/eviction_policy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plasma/eviction_policy.c b/src/plasma/eviction_policy.c index 77ed07b71..fc2533387 100644 --- a/src/plasma/eviction_policy.c +++ b/src/plasma/eviction_policy.c @@ -168,11 +168,13 @@ void require_space(eviction_state *eviction_state, int64_t required_space = eviction_state->memory_used + size - eviction_state->memory_capacity; if (required_space > 0) { - /* Try to free up as much free space as we need right now. */ + /* Try to free up at least as much space as we need right now but ideally + * up to 20% of the total capacity. */ + int64_t space_to_free = MAX(size, eviction_state->memory_capacity / 5); LOG_DEBUG("not enough space to create this object, so evicting objects"); /* Choose some objects to evict, and update the return pointers. */ int64_t num_bytes_evicted = choose_objects_to_evict( - eviction_state, plasma_store_info, required_space, num_objects_to_evict, + eviction_state, plasma_store_info, space_to_free, num_objects_to_evict, objects_to_evict); printf("Evicted %" PRId64 " bytes.\n", num_bytes_evicted); LOG_INFO(