Re: Request for detailed documentation of git pack protocol
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- May 15, 2009, 20:29 UTC
- Message-ID
- <alpine.LFD.2.01.0905151324280.3343@localhost.localdomain>
- In-Reply-To
- <4A0C3282.4000101@op5.se>
On Thu, 14 May 2009, Andreas Ericsson wrote:
Show 12 quoted lines
> Shawn O. Pearce wrote: > > > > In loopback mode for local file URIs, it may become an issue. C Git > > is just getting lucky by the pipe size I think. Though I thought I > > read somewhere yesterday pipe FIFOs in Linux were being allocated > > at 512 bytes, not one system page. Of course other systems could > > allocate whatever size they want too, and may allocate something > > below the 2952 minimum, and we'd most likely see a deadlock on them. > > > > Linux allocates one page 4096 bytes for a FIFO. 512 is the maximum > size guaranteed by POSIX to result in an atomic write.
Actually, modern Linux will allocate up to 16 pages (PIPE_BUFFERS), but they may not all be filled - we coalesce small writes only if the end result fits entirely into a page. So the maximum buffer is 16*PAGE_SIZE, and the minimum buffer space (assuming regular "write()" system calls) is something like 16*(PAGE_SIZE/2+1).
But yeah, POSIX allows for much smaller buffers.
Linus