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

Re: [PATCH] Limit file descriptors used by packs

From
Shawn Pearce <spearce@spearce.org>
Date
Mar 1, 2011, 14:58 UTC
Message-ID
<AANLkTik=FiwsQUg89MRXZX1-jR-fkF7uyJAimSXVSLvR@mail.gmail.com>
In-Reply-To
<7vwrkiex62.fsf@alter.siamese.dyndns.org>
On Tue, Mar 1, 2011 at 06:24, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes:
>
>> In this particular part of C Git, if we are bumping up against the
>> hard pack_max_fds limit we're already into some pretty difficult
>> computation. Trying to push the rlimit higher in order to avoid
>> close/open calls as we cycle through fds isn't really going to make
>> a huge difference on end-user latency for the command to finish
>> its task. So maybe we are better off honoring the rlim_cur that we
>> inherited from the user/environment.
>
> Let's step back a bit.
...
> For a .pack that fits inside a single pack window, however, can't we close
> the file descriptor immediately after mmap() it to obtain a sole window
> into it?

Yes. And its unrelated to this patch. You can still run out of file descriptors because you have a lot of large packs. :-)

I've considered this in the past, but avoided it because I thought the unuse_one_window() function might become more complex. But its not, we can just keep popping windows until the condition is met, which for a file descriptor is that we are below the limit.

I'll send a follow-up patch that builds on top of this one to close the pack fd if the entire thing fits into one window.

-- 
Shawn.
Previous: Junio C HamanoNext: Shawn O. Pearce
Message 9 of 10 in “Limit file descriptors used by packs”
  1. Limit file descriptors used by packsShawn O. Pearce, Feb 28, 2011
  2. Bernhard R. LinkFeb 28, 2011
  3. Shawn O. PearceFeb 28, 2011
  4. Junio C HamanoFeb 28, 2011
  5. Shawn O. PearceFeb 28, 2011
  6. Limit file descriptors used by packsShawn O. Pearce, Feb 28, 2011
  7. Erik Faye-LundFeb 28, 2011
  8. Junio C HamanoMar 1, 2011
  9. Shawn PearceMar 1, 2011
  10. 2/1 sha1_file.c: Don't retain open fds on small packsShawn O. Pearce, Mar 2, 2011

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.