Thomas Rast <trast@xxxxxxxxxxxxxxx> writes: > The threaded parts of index-pack increment the number of resolved > deltas in nr_resolved_deltas guarded by counter_mutex. However, the > per-thread outer loop accessed nr_resolved_deltas without any locks. > > This is not wrong as such, since it doesn't matter all that much > whether we get an outdated value. However, unless someone proves that > this one lock makes all the performance difference, it would be much > cleaner to guard _all_ accesses to the variable with the lock. > > The only such use is display_progress() in the threaded section (all > others are in the conclude_pack() callchain outside the threaded > part). To make it obvious that it cannot deadlock, move it out of > work_mutex. > > Signed-off-by: Thomas Rast <trast@xxxxxxxxxxxxxxx> > --- > >> The only thing I don't >> like here is the double locking (work_lock then counter_lock) is an >> invitation for potential deadlocks (not now, but who now what can >> change later). I think you could move work_lock(); down after >> counter_unlock() so we hold one lock at a time. > > Good point. Thanks guys for fixing my mess with these two patches. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html