git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Increase core.packedGitLimit

From
Jeff King <peff@peff.net>
Date
Apr 20, 2017, 21:02 UTC
Message-ID
<20170420210254.f4ykyi46bso5uj3o@sigill.intra.peff.net>
In-Reply-To
<20170420204118.17856-1-dturner@twosigma.com>
On Thu, Apr 20, 2017 at 04:41:18PM -0400, David Turner wrote:
Show 18 quoted lines
> When core.packedGitLimit is exceeded, git will close packs.  If there
> is a repack operation going on in parallel with a fetch, the fetch
> might open a pack, and then be forced to close it due to
> packedGitLimit being hit.  The repack could then delete the pack
> out from under the fetch, causing the fetch to fail.
> 
> Increase core.packedGitLimit's default value to prevent
> this.
> 
> On current 64-bit x86_64 machines, 48 bits of address space are
> available.  It appears that 64-bit ARM machines have no standard
> amount of address space (that is, it varies by manufacturer), and IA64
> and POWER machines have the full 64 bits.  So 48 bits is the only
> limit that we can reasonably care about.  We reserve a few bits of the
> 48-bit address space for the kernel's use (this is not strictly
> necessary, but it's better to be safe), and use up to the remaining
> 45.  No git repository will be anywhere near this large any time soon,
> so this should prevent the failure.
Yep, I think this is a reasonable direction.
> ---
>  git-compat-util.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

This probably needs an update to the core.packedGitLimit section of Documentation/config.txt.

Show 10 quoted lines
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 8a4a3f85e7..1c5de153a5 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -616,7 +616,7 @@ extern int git_lstat(const char *, struct stat *);
>  #endif
>  
>  #define DEFAULT_PACKED_GIT_LIMIT \
> -	((1024L * 1024L) * (size_t)(sizeof(void*) >= 8 ? 8192 : 256))
> +	((1024L * 1024L) * (size_t)(sizeof(void*) >= 8 ? (32 * 1024L * 1024L) : 256))

I wondered if we would run afoul of integer sizes on 64-bit systems where "long" is still only 32-bits (i.e., Windows). But I think it's OK, because the values before we cast to size_t are in megabytes. So your 32*1024*1024 needs only 25 bits to store it. And then after we cast to size_t, everything is in 64-bit.

-Peff
Previous: David TurnerNext: Johannes Schindelin
Message 2 of 13 in “Increase core.packedGitLimit”
  1. Increase core.packedGitLimitDavid Turner, Apr 20, 2017
  2. Jeff KingApr 20, 2017
  3. Johannes SchindelinApr 20, 2017
  4. David TurnerApr 20, 2017
  5. Johannes SchindelinApr 21, 2017
  6. docs: update 64-bit core.packedGitLimit defaultJeff King, Jun 21, 2017
  7. Stefan BellerJun 21, 2017
  8. Jeff KingJun 21, 2017
  9. Junio C HamanoJun 21, 2017
  10. Jeff KingJun 21, 2017
  11. Junio C HamanoJun 21, 2017
  12. Jeff KingJun 21, 2017
  13. Jeff KingJun 21, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.