Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Koji Nakamaru <koji.nakamaru@gree.net>
Cc: Koji Nakamaru via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] macOS: queue for munmap operations
Date: Wed, 22 Oct 2025 05:05:39 -0400	[thread overview]
Message-ID: <20251022090539.GA853931@coredump.intra.peff.net> (raw)
In-Reply-To: <CAOTNsDxoSFTBwaO0Eqr+r0NQOwdA2Fge3CN7JQtnAWEt2PnDew@mail.gmail.com>

On Wed, Oct 22, 2025 at 10:21:32AM +0900, Koji Nakamaru wrote:

> > Ditto here. I'd be curious how well packed the repo is, and how it does
> > after a repack. If it has a very large packfile, you might also try:
> >
> >   git config core.packedGitWindowSize 4G
> >
> > or similar (though for just an ls-tree, we should only be looking at
> > tree objects, which in general I'd expect to be in a confined area of
> > the packfile; so the 1GB window is probably plenty).
> 
> Following your suggestion, I investigated the number of mmap calls in
> other environments and found much smaller counts. I tracked how
> xmmap_gently() was called in packfile.c and found
> settings->packed_git_window_size was different between environments. My
> ~/.gitconfig defined "packedGitLimit = 128m" and this caused many calls.

Ah, very interesting. Yes, I think that helps explain why there were so
many mmap calls. I don't think there's a good reason to lower that
number in general, assuming the OS is reasonably good at dropping mapped
pages from RAM when there's memory pressure.

> In my extreme cases, this batching makes them faster. Queue flushing has
> occurred several times for the private repository case and not occurred
> for the Linux kernel case. Though I haven't investigated in detail,
> memory pressure doesn't seem to be critical (and it could also be
> possible to adopt smarter thresholds).

OK, that's quite interesting that batching makes such a difference. I
guess somebody with more knowledge of macOS kernel internals could
probably explain it. Though it sounds like your problem was sufficiently
solved by dropping the extra config, it's a good fact for us to know
about in general.

-Peff

      reply	other threads:[~2025-10-22  9:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20 22:35 [PATCH] macOS: queue for munmap operations Koji Nakamaru via GitGitGadget
2025-10-21  6:26 ` Torsten Bögershausen
2025-10-22  1:22   ` Koji Nakamaru
2025-10-21  8:06 ` Jeff King
2025-10-22  1:21   ` Koji Nakamaru
2025-10-22  9:05     ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251022090539.GA853931@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=koji.nakamaru@gree.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox