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

Re: [PATCH] Add support for changing packed_git_window_size at process start time

From
Shawn O. Pearce <spearce@spearce.org>
Date
Dec 21, 2008, 22:28 UTC
Message-ID
<20081221222848.GE17355@spearce.org>
In-Reply-To
<1229895454-19498-2-git-send-email-tyler@slide.com>
"R. Tyler Ballance" <tyler@slide.com> wrote:
> "Works" insofar that it will alter the packed_git_window_size variable in environment.c
> when the environment is set up. It /doesn't/ work when commands like git-diff(1) and git-log(1)
> call get_revision() which seems to disregard the setting if the packed_window_size is set to something
> low (i.e. ulimit -v 32768)

I think you are tweaking the wrong variable here. Its more than just the window size that matters to how much of the ulimit we use. Its also packed_git_limit, which on a 64 bit system is 8 GB.

That's probably why get_revision doesn't seem to honor this as a setting. Yea, its down to 0.85% of your ulimit per window, but we'll still try to open a new window because we have space left before the 8 GB limit.

I think this is a good idea, trying to fit within the ulimit rather than assuming we can take whatever we please. But you also need to drop the packed_git_limit down.

My suggestion is this:
	packed_git_limit = as->rlim_cur * 0.85;
	packed_git_window_size = packed_git_limit / 4;
or maybe / 2.  You really want at least 2 windows available within
your limit.
 
Show 12 quoted lines
> @@ -75,6 +78,13 @@ static void setup_git_env(void)
>  	git_graft_file = getenv(GRAFT_ENVIRONMENT);
>  	if (!git_graft_file)
>  		git_graft_file = git_pathdup("info/grafts");
> +	
> +	if (DYNAMIC_WINDOW_SIZE) {
> +		struct rlimit *as = malloc(sizeof(struct rlimit));
> +		if ( (getrlimit(RLIMIT_AS, as) == 0) && ((int)(as->rlim_cur) > 0) ) 
> +			packed_git_window_size = (unsigned int)(as->rlim_cur * DYNAMIC_WINDOW_SIZE_PERCENTAGE);
> +		free(as);
> +	}
>  }
-- 
Shawn.
Previous: Shawn O. PearceNext: R. Tyler Ballance
Message 6 of 8 in “Dynamically adjusting packed_git_window_size”
  1. R. Tyler BallanceDec 21, 2008
  2. Add support for changing packed_git_window_size at process start timeR. Tyler Ballance, Dec 21, 2008
  3. Style changes per suggestions from Junio in #gitR. Tyler Ballance, Dec 21, 2008
  4. Matthieu MoyDec 21, 2008
  5. Shawn O. PearceDec 21, 2008
  6. Shawn O. PearceDec 21, 2008
  7. R. Tyler BallanceDec 22, 2008
  8. Shawn O. PearceDec 26, 2008

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.