ソースを参照

Do not try to reuse potentially in use memory chucks only for prefetches

We were already doing it for chuncks that do not have the same data
interface, but those that have the same data interface are in the same
situation.
Samuel Thibault 4 年 前
コミット
8fa6397b55
共有1 個のファイルを変更した10 個の追加9 個の削除を含む
  1. 10 9
      src/datawizard/memalloc.c

+ 10 - 9
src/datawizard/memalloc.c

@@ -1529,9 +1529,19 @@ static starpu_ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, st
 			}
 			reclaim -= freed;
 
+			if (is_prefetch)
+			{
+				/* It's just prefetch, don't bother existing allocations */
+				/* And don't bother tracing allocation attempts */
+				prefetch_out_of_memory[dst_node] = 1;
+				/* TODO: ideally we should not even try to allocate when we know we have not freed anything */
+				continue;
+			}
+
 			/* Try to reuse an allocated data with the same interface (to avoid spurious free/alloc) */
 			if (_starpu_has_not_important_data && try_to_reuse_not_important_mc(dst_node, handle, replicate, footprint, is_prefetch))
 				break;
+
 			if (try_to_reuse_potentially_in_use_mc(dst_node, handle, replicate, footprint, is_prefetch))
 			{
 				reused = 1;
@@ -1539,15 +1549,6 @@ static starpu_ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, st
 				break;
 			}
 
-			if (is_prefetch)
-			{
-				/* It's just prefetch, don't bother existing allocations */
-				/* And don't bother tracing allocation attempts */
-				prefetch_out_of_memory[dst_node] = 1;
-				/* TODO: ideally we should not even try to allocate when we know we have not freed anything */
-				continue;
-			}
-
 			if (!told_reclaiming)
 			{
 				/* Prevent prefetches and such from happening */