Browse Source

Do not trigger reclaiming at all if there is enough room in a memory node, even if all its data are dirty. That's needed behavior for e.g. stencils

Samuel Thibault 9 years ago
parent
commit
bfea917d2c
1 changed files with 7 additions and 7 deletions
  1. 7 7
      src/datawizard/memalloc.c

+ 7 - 7
src/datawizard/memalloc.c

@@ -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;