Re: [PATCH 2/2] upload-pack: reduce lock contention when writing packfile data
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 3, 2026, 13:47 UTC
- Message-ID
- <aabmXF5D1rMRZgP3@pks.im>
- In-Reply-To
- <20260303133540.GA818878@coredump.intra.peff.net>
On Tue, Mar 03, 2026 at 08:35:40AM -0500, Jeff King wrote:
Show 17 quoted lines
> On Tue, Mar 03, 2026 at 10:31:46AM +0100, Patrick Steinhardt wrote: > > We would likely hit this issue if we insist on the buffer being > > completely filled before sending it out. But that's why I adapted the > > logic to say that we send out once we've filled it at least 2/3rds of > > the pktline limit. So in your case above we wouldn't face an issue as > > we'd already send the first 50kB, as it is smaller than 2/3rds of the > > maximum length (~42kB). > > > > That being said, you'll still be able to construct cases where we have > > weird edge cases. For example if you consistently send one byte less > > than 2/3rds of the capacity. > > Right, my numbers were just meant as examples. Whatever the values, it > means that whatever is generating the pack data (pack-objects or > otherwise) really wants to be in sync with how upload-pack is buffering. > Or vice versa. If we just pass back whole chunks of what we read() in > upload-pack, then that happens automatically.
Yeah, that's fair. I'll include this part in v2 for now so that we can discuss once the bigger picture emerges :)
Thanks!
Patrick