On Mon, Jan 21, 2019 at 2:02 AM Duy Nguyen <pclouds@xxxxxxxxx> wrote: > > On Sat, Jan 19, 2019 at 10:45 PM Patrick Hogg <phogg@xxxxxxxxxxxx> wrote: > > > > ac77d0c37 ("pack-objects: shrink size field in struct object_entry", > > 2018-04-14) added an extra usage of read_lock/read_unlock in the newly > > introduced oe_get_size_slow for thread safety in parallel calls to > > try_delta(). Unfortunately oe_get_size_slow is also used in serial > > code, some of which is called before the first invocation of > > ll_find_deltas. As such the read mutex is not guaranteed to be > > initialized. > > > > Resolve this by using the existing lock in packing_data which is > > initialized early in cmd_pack_objects instead of read_mutex. > > Additionally, upgrade the packing_data lock to a recursive mutex to > > make it a suitable replacement for read_mutex. > > > > Signed-off-by: Patrick Hogg <phogg@xxxxxxxxxxxx> > > --- > > > > As I mentioned in the prior thread I think that it will be simpler > > to simply use the existing lock in packing_data instead of moving > > read_mutex. I can go back to simply moving read_mutex to the > > packing_data struct if that that is preferable, though. > > In early iterations of these changes, I think we hit high contention > when sharing the mutex [1]. I don't know if we will hit the same > performance problem again with this patch. It would be great if Elijah > with his zillion core machine could test this out. Otherwise it may be > just safer to keep the two mutexes separate. Testing...