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

Re: Something is broken in repack

From
Nicolas Pitre <nico@cam.org>
Date
Dec 12, 2007, 15:48 UTC
Message-ID
<alpine.LFD.0.99999.0712120743040.555@xanadu.home>
In-Reply-To
<alpine.LFD.0.99999.0712112057390.555@xanadu.home>
On Wed, 12 Dec 2007, Nicolas Pitre wrote:
Show 12 quoted lines
> Add memory fragmentation to that and you have a clogged system.
> 
> Solution: 
> 
> 	pack.deltacachesize=1
> 	pack.windowmemory=16M
> 
> Limiting the window memory to 16MB will automatically shrink the window 
> size when big objects are encountered, therefore keeping much fewer of 
> those objects at the same time in memory, which in turn means they will 
> be processed much more quickly.  And somehow that must help with memory 
> fragmentation as well.
OK scrap that.

When I returned to the computer this morning, the repack was completed... with a 1.3GB pack instead.

So... The gcc repo apparently really needs a large window to efficiently compress those large objects.

But when those large objects are already well deltified and you repack again with a large window, somehow the memory allocator is way more involved, probably even more so when there are several threads in parallel amplifying the issue, and things probably get to a point of no return with regard to memory fragmentation after a while.

So... my conclusion is that the glibc allocator has fragmentation issues with this work load, given the notable difference with the Google allocator, which itself might not be completely immune to fragmentation issues of its own. And because the gcc repo requires a large window of big objects to get good compression, then you're better not using 4 threads to repack it with -a -f. The fact that the size of the source pack has such an influence is probably only because the increased usage of the delta base object cache is playing a role in the global memory allocation pattern, allowing for the bad fragmentation issue to occur.

If you could run one last test with the mallinfo patch I posted, without the pack.windowmemory setting, and adding the reported values along with those from top, then we could formally conclude to memory fragmentation issues.

So I don't think Git itself is actually bad. The gcc repo most certainly constitute a nasty use case for memory allocators, but I don't think there is much we can do about it besides possibly implementing our own memory allocator with active defragmentation where possible (read memcpy) at some point to give glibc's allocator some chance to breathe a bit more.

In the mean time you might have to use only one thread and lots of memory to repack the gcc repo, or find the perfect memory allocator to be used with Git. After all, packing the whole gcc history to around 230MB is quite a stunt but it requires sufficient resources to achieve it. Fortunately, like Linus said, such a wholesale repack is not something that most users have to do anyway.

Nicolas
Previous: Wolfram GlogerNext: Paolo Bonzini
Message 45 of 82 in “Something is broken in repack”
  1. Jon SmirlDec 7, 2007
  2. Linus TorvaldsDec 8, 2007
  3. pack-objects: fix delta cache size accountingNicolas Pitre, Dec 8, 2007
  4. Nicolas PitreDec 8, 2007
  5. Jon SmirlDec 8, 2007
  6. Nicolas PitreDec 8, 2007
  7. Jon SmirlDec 8, 2007
  8. David BrownDec 8, 2007
  9. Jon SmirlDec 8, 2007
  10. Nicolas PitreDec 8, 2007
  11. Jon SmirlDec 8, 2007
  12. Nicolas PitreDec 8, 2007
  13. Harvey HarrisonDec 8, 2007
  14. Jon SmirlDec 8, 2007
  15. Harvey HarrisonDec 8, 2007
  16. Junio C HamanoDec 8, 2007
  17. Junio C HamanoDec 9, 2007
  18. Jon SmirlDec 9, 2007
  19. Jon SmirlDec 9, 2007
  20. Nicolas PitreDec 10, 2007
  21. Nicolas PitreDec 10, 2007
  22. David BrownDec 8, 2007
  23. Nicolas PitreDec 10, 2007
  24. Jon SmirlDec 10, 2007
  25. Morten WelinderDec 10, 2007
  26. Jon SmirlDec 11, 2007
  27. Junio C HamanoDec 11, 2007
  28. Nicolas PitreDec 11, 2007
  29. David KastrupDec 11, 2007
  30. Pierre HabouzitDec 11, 2007
  31. David KastrupDec 11, 2007
  32. Nicolas PitreDec 11, 2007
  33. Jon SmirlDec 11, 2007
  34. Jon SmirlDec 11, 2007
  35. Jon SmirlDec 11, 2007
  36. Andreas EricssonDec 11, 2007
  37. Nicolas PitreDec 11, 2007
  38. Nicolas PitreDec 11, 2007
  39. Jon SmirlDec 11, 2007
  40. Nicolas PitreDec 11, 2007
  41. Jon SmirlDec 11, 2007
  42. Nicolas PitreDec 12, 2007
  43. David KastrupDec 12, 2007
  44. Wolfram GlogerDec 14, 2007
  45. Nicolas PitreDec 12, 2007
  46. Paolo BonziniDec 12, 2007
  47. Linus TorvaldsDec 12, 2007
  48. David MillerDec 12, 2007
  49. Linus TorvaldsDec 12, 2007
  50. Jon SmirlDec 12, 2007
  51. Wolfram GlogerDec 14, 2007
  52. David KastrupDec 14, 2007
  53. Wolfram GlogerDec 14, 2007
  54. Nguyen Thai Ngoc DuyDec 13, 2007
  55. Paolo BonziniDec 13, 2007
  56. Paolo BonziniDec 13, 2007
  57. Johannes SixtDec 13, 2007
  58. Jakub NarebskiDec 14, 2007
  59. Paolo BonziniDec 14, 2007
  60. Nguyen Thai Ngoc DuyDec 14, 2007
  61. Paolo BonziniDec 14, 2007
  62. Harvey HarrisonDec 14, 2007
  63. Jakub NarebskiDec 14, 2007
  64. Nguyen Thai Ngoc DuyDec 14, 2007
  65. Nicolas PitreDec 14, 2007
  66. Nicolas PitreDec 12, 2007
  67. Andreas EricssonDec 13, 2007
  68. Wolfram GlogerDec 14, 2007
  69. Linus TorvaldsDec 11, 2007
  70. Nicolas PitreDec 11, 2007
  71. David MillerDec 11, 2007
  72. Nicolas PitreDec 11, 2007
  73. Andreas EricssonDec 11, 2007
  74. Jon SmirlDec 11, 2007
  75. Nicolas PitreDec 11, 2007
  76. Linus TorvaldsDec 11, 2007
  77. Junio C HamanoDec 11, 2007
  78. Andreas EricssonDec 11, 2007
  79. Daniel BerlinDec 11, 2007
  80. Nicolas PitreDec 11, 2007
  81. SeanDec 11, 2007
  82. Jon SmirlDec 11, 2007

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.