public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Dragan Simic <dsimic@manjaro.org>
To: "Toralf Förster" <toralf.foerster@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: cloning the linxu kernel repo at a VPS with small RAM
Date: Thu, 08 Feb 2024 21:16:31 +0100	[thread overview]
Message-ID: <6c4e309aa77e534cffdba9ae56032b99@manjaro.org> (raw)
In-Reply-To: <2f773980-70ec-4ad0-a49c-3ac12c294a39@gmx.de>

Hello Toralf,

On 2024-02-08 18:32, Toralf Förster wrote:
> Situation:
> 
> The command
>     git clone
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
> fails at a virtual server with about 2 GiB RAM under a recent Debian
> bookworm with git 2.39.2. What works for me:
>       git clone --depth=1
> https://git.kernel.org/pub/scm/linux/kernel/git/stable
>       cd ./linux
>       git config gc.auto 0
>       git config pack.threads 1
>       git fetch --tags
> as seen in [1].
> 
> Q:
> I do wonder if Git could automatically try to deal with only 1.5 GiB
> available RAM?

Here's an excerpt from my ~/.bashrc, which sets the things up
on my Pinebook Pro laptop with an RK3399 SoC and 4 GB of RAM,
which is also thermally constrained:

# Missing nproc(1) is handled properly
REASONABLE_THREADS=$(nproc 2> /dev/null || echo 1)
REASONABLE_THREADS=$((${REASONABLE_THREADS} / 2))
((${REASONABLE_THREADS} == 0)) && REASONABLE_THREADS=1

export GIT_CONFIG_COUNT=3
export GIT_CONFIG_KEY_0='grep.threads'
export GIT_CONFIG_VALUE_0=${REASONABLE_THREADS}
export GIT_CONFIG_KEY_1='index.threads'
export GIT_CONFIG_VALUE_1=${REASONABLE_THREADS}
export GIT_CONFIG_KEY_2='pack.threads'
export GIT_CONFIG_VALUE_2=${REASONABLE_THREADS}

export ZSTD_NBTHREADS=${REASONABLE_THREADS}
unset REASONABLE_THREADS

Obviously, this does a bit more than configuring git only.

Perhaps modifying this to additionally take the amount of RAM
into the calculation of REASONABLE_THREADS could be a solution
for your use case?

  reply	other threads:[~2024-02-08 20:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08 17:32 cloning the linxu kernel repo at a VPS with small RAM Toralf Förster
2024-02-08 20:16 ` Dragan Simic [this message]
2024-02-08 20:35   ` Dragan Simic
2024-02-09  1:29 ` Eric Wong
2024-02-10 10:35 ` Toralf Förster

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=6c4e309aa77e534cffdba9ae56032b99@manjaro.org \
    --to=dsimic@manjaro.org \
    --cc=git@vger.kernel.org \
    --cc=toralf.foerster@gmx.de \
    /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