Re: [PATCH v2] pack-objects: fix performance issues on packing large deltas

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 22.07.2018 um 10:04 schrieb Nguyễn Thái Ngọc Duy:
+	if (size < pack->oe_delta_size_limit) {
+		e->delta_size_ = size;
+		e->delta_size_valid = 1;
+	} else {
+		packing_data_lock(pack);
+		if (!pack->delta_size)
+			ALLOC_ARRAY(pack->delta_size, pack->nr_alloc);
+		packing_data_unlock(pack);
+
+		pack->delta_size[e - pack->objects] = size;

My first thought was that this is wrong (falling prey to the same mistake as the double-checked locking pattern). But after thinking twice over it again, I think that this unprotected access of pack->delta_size is thread-safe.

Of course, I'm assuming that different threads never assign to the same array index.

+		e->delta_size_valid = 0;
+	}
  }

-- Hannes



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux