Преглед изворни кода

Bug fix: Do not hold the header lock while executing the callback when we don't
need to create a data request (ie. during a cache hit).

Cédric Augonnet пре 14 година
родитељ
комит
517d6385e3
2 измењених фајлова са 9 додато и 5 уклоњено
  1. 6 3
      src/datawizard/coherency.c
  2. 3 2
      src/datawizard/write_back.c

+ 6 - 3
src/datawizard/coherency.c

@@ -224,6 +224,8 @@ starpu_data_request_t create_request_to_fetch_data(starpu_data_handle handle,
 		_starpu_update_data_state(handle, dst_replicate, mode);
 		_starpu_msi_cache_hit(requesting_node);
 
+		_starpu_spin_unlock(&handle->header_lock);
+
 		if (callback_func)
 			callback_func(callback_arg);
 
@@ -341,13 +343,14 @@ int _starpu_fetch_data_on_node(starpu_data_handle handle, struct starpu_data_rep
 	r = create_request_to_fetch_data(handle, dst_replicate, mode,
 					is_prefetch, callback_func, callback_arg);
 
-	_starpu_spin_unlock(&handle->header_lock);
-
 	/* If no request was created, the handle was already up-to-date on the
-	 * node */
+	 * node. In this case, create_request_to_fetch_data has already
+	 * unlocked the header. */
 	if (!r)
 		return 0;
 	
+	_starpu_spin_unlock(&handle->header_lock);
+
 	int ret = is_prefetch?0:_starpu_wait_data_request_completion(r, 1);
         _STARPU_LOG_OUT();
         return ret;

+ 3 - 2
src/datawizard/write_back.c

@@ -41,12 +41,13 @@ void _starpu_write_through_data(starpu_data_handle handle, uint32_t requesting_n
 				r = create_request_to_fetch_data(handle, &handle->per_node[node],
 								STARPU_R, 0, NULL, NULL);
 
-			        _starpu_spin_unlock(&handle->header_lock);
-
 			        /* If no request was created, the handle was already up-to-date on the
 			         * node */
 			        if (r)
+				{
+				        _starpu_spin_unlock(&handle->header_lock);
         				_starpu_wait_data_request_completion(r, 1);
+				}
 			}
 		}
 	}