Download raw body.
git parallel threads revisited
04.06.2025 14:52, Stuart Henderson пишет:
> claudio noticed that at least 'git checkout' still spawns a lot of
> threads; does this seem more reasonable?
So git limits itself to #define MAX_PARALLEL (20) threads and you just
add a first cap to what we can reasonably run at most - makes sense.
With 7.7-stable, I see 21 'git checkout ...' in top(1) on this box:
hw.machine=sparc64
hw.ncpuonline=16
Haven't tested the patch there, but pretty sure there will be one proc
and 16 additional threads in top, which, I guess, is quite similar to
what claudio runs into.
It might make sense to limit this further, but your clamp additional
clamp is certainly OK with me, thanks.
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/git/Makefile,v
> diff -u -p -r1.287 Makefile
> --- Makefile 19 May 2025 14:23:44 -0000 1.287
> +++ Makefile 4 Jun 2025 11:51:02 -0000
> @@ -3,7 +3,7 @@ COMMENT-svn = subversion interoperabilit
> COMMENT-x11 = graphical tools
>
> V = 2.49.0
> -REVISION = 1
> +REVISION = 2
> DISTNAME = git-${V}
> CATEGORIES = devel
>
> Index: patches/patch-preload-index_c
> ===================================================================
> RCS file: patches/patch-preload-index_c
> diff -N patches/patch-preload-index_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-preload-index_c 4 Jun 2025 11:51:02 -0000
> @@ -0,0 +1,12 @@
> +Index: preload-index.c
> +--- preload-index.c.orig
> ++++ preload-index.c
> +@@ -124,6 +124,8 @@ void preload_index(struct index_state *index,
> + trace2_region_enter("index", "preload", NULL);
> +
> + trace_performance_enter();
> ++ if (threads > online_cpus())
> ++ threads = online_cpus();
> + if (threads > MAX_PARALLEL)
> + threads = MAX_PARALLEL;
> + offset = 0;
>
git parallel threads revisited