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

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

From
Derrick Stolee <stolee@gmail.com>
Date
Jun 3, 2026, 12:24 UTC
Message-ID
<c4a32a6f-70bf-4ff4-abbf-d6e301246b5b@gmail.com>
In-Reply-To
<pull.2131.v3.git.1780445118653.gitgitgadget@gmail.com>
On 6/2/26 8:05 PM, Arijit Banerjee via GitGitGadget wrote:
Show 7 quoted lines
>      Changes since v2:
>      
>       * Addressed Jeff King's review question by releasing cached base data
>         after all direct children have been dispatched, while keeping the
>         existing subtree bookkeeping intact.
>       * Re-ran t/t5302-pack-index.sh, p5302-pack-index.sh, and end-to-end
>         full clone spot checks with the precise-release version.
...
Show 6 quoted lines
> +static int base_data_has_remaining_direct_children(struct base_data *c)
> +{
> +	return c->ref_first <= c->ref_last ||
> +	       c->ofs_first <= c->ofs_last;
> +}
> +

I'm glad you were able to find some bookkeeping that already exists to help with this decision.

Show 14 quoted lines
>   static void prune_base_data(struct base_data *retain)
>   {
>   	struct list_head *pos;
> @@ -1201,8 +1207,12 @@ static void *threaded_second_pass(void *data)
>   		}
>   
>   		work_lock();
> -		if (parent)
> +		if (parent) {
>   			parent->retain_data--;
> +			if (!parent->retain_data &&
> +			    !base_data_has_remaining_direct_children(parent))
> +				free_base_data(parent);
> +		}
This appears like the correct place to do this.
Show 7 quoted lines
>   		if (child && child->data) {
>   			/*
> @@ -1212,7 +1222,6 @@ static void *threaded_second_pass(void *data)
>   			list_add(&child->list, &work_head);
>   			base_cache_used += child->size;
>   			prune_base_data(NULL);
> -			free_base_data(child);
And still we don't want this universal free.

Thanks for re-running your performance numbers after this change. I didn't see any significant difference in the relative changes.

I don't think we have a way of measuring "memory pressure" during the performance test suite. Did you see any evidence that this change has the intended effect of reducing process memory proactively instead of relying on the cache evictions?

Thanks, -Stolee

Previous: Arijit Banerjee via GitGitGadgetNext: Jeff King
Message 6 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.