|
@@ -944,6 +944,13 @@ void starpu_memchunk_tidy(unsigned node)
|
|
|
starpu_ssize_t available = starpu_memory_get_available(node);
|
|
|
size_t target, amount;
|
|
|
|
|
|
+ /* Count cached allocation as being available */
|
|
|
+ available += mc_cache_size[node];
|
|
|
+
|
|
|
+ if (total > 0 && available >= (total * minimum_p) / 100)
|
|
|
+ /* Enough available space, do not trigger reclaiming */
|
|
|
+ return;
|
|
|
+
|
|
|
if (mc_clean_nb[node] < (mc_nb[node] * minimum_clean_p) / 100)
|
|
|
{
|
|
|
struct _starpu_mem_chunk *mc, *orig_next_mc, *next_mc;
|
|
@@ -1061,13 +1068,6 @@ void starpu_memchunk_tidy(unsigned node)
|
|
|
if (total <= 0)
|
|
|
return;
|
|
|
|
|
|
- /* Count cached allocation as being available */
|
|
|
- available += mc_cache_size[node];
|
|
|
-
|
|
|
- if (available >= (total * minimum_p) / 100)
|
|
|
- /* Enough available space, do not trigger reclaiming */
|
|
|
- return;
|
|
|
-
|
|
|
/* Not enough available space, reclaim until we reach the target. */
|
|
|
target = (total * target_p) / 100;
|
|
|
amount = target - available;
|