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

Re: [PATCH v2] index-pack: retain child bases in delta cache

From
Jeff King <peff@peff.net>
Date
Jun 2, 2026, 06:45 UTC
Message-ID
<20260602064519.GD695568@coredump.intra.peff.net>
In-Reply-To
<pull.2131.v2.git.1780330402264.gitgitgadget@gmail.com>
On Mon, Jun 01, 2026 at 04:13:21PM +0000, Arijit Banerjee via GitGitGadget wrote:
Show 13 quoted lines
> When resolving a delta whose result has children of its own,
> index-pack adds the result to work_head, accounts its data in
> base_cache_used, and calls prune_base_data(). It then immediately frees
> that same data.
> 
> This bypasses the existing delta base cache policy and can force later
> descendants to reconstruct the queued base again. Let the existing
> delta_base_cache_limit pruning policy decide whether to keep or evict
> the data instead.
> 
> This does not add a new cache or increase the cache limit. The object
> data is already accounted in base_cache_used before prune_base_data()
> runs, and the existing pruning and base cleanup paths still release it.

That explanation makes sense, but I'm left with one question/concern. Dropping the data for a base makes sense when we are "done" with it, because we know we won't need it anymore and it leaves more room in the cache for things we do care about.

The problem here is that the current notion of "done" is not correct. Imagine we have delta chains "A -> B -> C" and "A -> D -> F". We are totally done with A when we have resolved both B and D, but if I understand correctly, we currently throw it away after just resolving B.

Your patch never throws it away, and just waits for it to get evicted from the cache due to memory pressure. But could we realize the moment when B and D have both finished using it, and evict it then? That makes it more likely for us to keep something useful in the cache when there is pressure.

I'm not sure how hard that would be in practice, or how much it would help (the base cache works in list order, so I think it might naturally be a sort of LRU?).

-Peff
Previous: Arijit Banerjee via GitGitGadgetNext: Arijit Banerjee via GitGitGadget
Message 4 of 11 in “index-pack: retain child bases in delta cache”
  1. index-pack: retain child bases in delta cacheArijit Banerjee via GitGitGadget, May 29, 2026
  2. Derrick StoleeJun 1, 2026
  3. index-pack: retain child bases in delta cacheArijit Banerjee via GitGitGadget, Jun 1, 2026
  4. Jeff KingJun 2, 2026
  5. index-pack: retain child bases in delta cacheArijit Banerjee via GitGitGadget, Jun 3, 2026
  6. Derrick StoleeJun 3, 2026
  7. Jeff KingJun 4, 2026
  8. Arijit BanerjeeJun 5, 2026
  9. Junio C HamanoJun 10, 2026
  10. Jeff KingJun 11, 2026
  11. Junio C HamanoJun 11, 2026

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.