git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] index-pack: adjust default threading cap
Date: Sat, 22 Aug 2020 01:16:07 +0000	[thread overview]
Message-ID: <20200822011607.GX8085@camp.crustytoothpaste.net> (raw)
In-Reply-To: <20200821175800.GC3263141@coredump.intra.peff.net>

[-- Attachment #1: Type: text/plain, Size: 1674 bytes --]

On 2020-08-21 at 17:58:00, Jeff King wrote:
> diff --git a/builtin/index-pack.c b/builtin/index-pack.c
> index f865666db9..9721bf1ffe 100644
> --- a/builtin/index-pack.c
> +++ b/builtin/index-pack.c
> @@ -1798,9 +1798,22 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
>  
>  	if (HAVE_THREADS && !nr_threads) {
>  		nr_threads = online_cpus();
> -		/* An experiment showed that more threads does not mean faster */
> -		if (nr_threads > 3)
> -			nr_threads = 3;
> +		/*
> +		 * Experiments show that going above 20 threads doesn't help,
> +		 * no matter how many cores you have. Below that, we tend to
> +		 * max at half the number of online_cpus(), presumably because
> +		 * half of those are hyperthreads rather than full cores. We'll
> +		 * never reduce the level below "3", though, to match a
> +		 * historical value that nobody complained about.
> +		 */
> +		if (nr_threads < 4)
> +			; /* too few cores to consider capping */
> +		else if (nr_threads < 6)
> +			nr_threads = 3; /* historic cap */
> +		else if (nr_threads < 40)
> +			nr_threads /= 2;

I was going to ask if we could make the halving conditional on x86_64,
but it turns out POWER and UltraSPARC also have SMT, so that doesn't
make sense.  I expect that most users who have more than 6 "cores" are
going to be on one of those systems or possibly ARM64, and since the
performance penalty of using half as many cores isn't that significant,
I'm not sure it's worth worrying about further.  This will be an
improvement regardless.

Which is just a long way of saying, this patch seems fine to me.
-- 
brian m. carlson: Houston, Texas, US

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  parent reply	other threads:[~2020-08-22  1:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 17:51 [PATCH 0/3] index-pack threading defaults Jeff King
2020-08-21 17:53 ` [PATCH 1/3] p5302: disable thread-count parameter tests by default Jeff King
2020-08-21 17:54 ` [PATCH 2/3] p5302: count up to online-cpus for thread tests Jeff King
2020-08-21 17:58   ` Jeff King
2020-08-21 17:58 ` [PATCH 3/3] index-pack: adjust default threading cap Jeff King
2020-08-21 18:08   ` Eric Sunshine
2020-08-21 18:41     ` Jeff King
2020-08-22  1:16   ` brian m. carlson [this message]
2020-08-24 17:37     ` Jeff King
2020-08-24 17:55       ` Eric Sunshine
2020-08-21 18:44 ` [PATCH 0/3] index-pack threading defaults Jeff King
2020-08-21 18:59   ` Junio C Hamano
2020-08-21 19:14     ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20200822011607.GX8085@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).