Skip to content

Commit 22bac0e

Browse files
spearceJunio C Hamano
authored andcommitted
Increase packedGit{Limit,WindowSize} on 64 bit systems.
If we have a 64 bit address space we can easily afford to commit a larger amount of virtual address space to pack file access. So on these platforms we should increase the default settings of core.packedGit{Limit,WindowSize} to something that will better handle very large projects. Thanks to Andy Whitcroft for pointing out that we can safely increase these defaults on such systems. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent eb92242 commit 22bac0e

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

Documentation/config.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,12 @@ core.packedGitWindowSize::
125125
more quickly. Smaller window sizes will negatively affect
126126
performance due to increased calls to the operating system's
127127
memory manager, but may improve performance when accessing
128-
a large number of large pack files. Default is 32 MiB,
129-
which should be reasonable for all users/operating systems.
130-
You probably do not need to adjust this value.
128+
a large number of large pack files.
129+
+
130+
Default is 1 MiB if NO_MMAP was set at compile time, otherwise 32
131+
MiB on 32 bit platforms and 1 GiB on 64 bit platforms. This should
132+
be reasonable for all users/operating systems. You probably do
133+
not need to adjust this value.
131134
+
132135
Common unit suffixes of 'k', 'm', or 'g' are supported.
133136

@@ -136,9 +139,10 @@ core.packedGitLimit::
136139
from pack files. If Git needs to access more than this many
137140
bytes at once to complete an operation it will unmap existing
138141
regions to reclaim virtual address space within the process.
139-
Default is 256 MiB, which should be reasonable for all
140-
users/operating systems, except on the largest projects.
141-
You probably do not need to adjust this value.
142+
+
143+
Default is 256 MiB on 32 bit platforms and 8 GiB on 64 bit platforms.
144+
This should be reasonable for all users/operating systems, except on
145+
the largest projects. You probably do not need to adjust this value.
142146
+
143147
Common unit suffixes of 'k', 'm', or 'g' are supported.
144148

git-compat-util.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,17 @@ extern int git_munmap(void *start, size_t length);
9797
#else /* NO_MMAP */
9898

9999
#include <sys/mman.h>
100-
#define DEFAULT_PACKED_GIT_WINDOW_SIZE (32 * 1024 * 1024)
100+
#define DEFAULT_PACKED_GIT_WINDOW_SIZE \
101+
(sizeof(void*) >= 8 \
102+
? 1 * 1024 * 1024 * 1024 \
103+
: 32 * 1024 * 1024)
101104

102105
#endif /* NO_MMAP */
103106

104-
#define DEFAULT_PACKED_GIT_LIMIT (256 * 1024 * 1024)
107+
#define DEFAULT_PACKED_GIT_LIMIT \
108+
(sizeof(void*) >= 8 \
109+
? 8 * 1024 * 1024 * 1024 \
110+
: 256 * 1024 * 1024)
105111

106112
#ifdef NO_SETENV
107113
#define setenv gitsetenv

0 commit comments

Comments
 (0)