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

Re: [PATCHv3 07/13] fetch_populated_submodules: use new parallel job processing

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 22, 2015, 16:28 UTC
Message-ID
<xmqqvbb24dvj.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1442875159-13027-8-git-send-email-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 22 quoted lines
> In a later patch we enable parallel processing of submodules, this
> only adds the possibility for it. So this change should not change
> any user facing behavior.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>  builtin/fetch.c |   3 +-
>  submodule.c     | 119 +++++++++++++++++++++++++++++++++++++++-----------------
>  submodule.h     |   2 +-
>  3 files changed, 87 insertions(+), 37 deletions(-)
>
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index ee1f1a9..6620ed0 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -1217,7 +1217,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
>  		result = fetch_populated_submodules(&options,
>  						    submodule_prefix,
>  						    recurse_submodules,
> -						    verbosity < 0);
> +						    verbosity < 0,
> +						    0);
This one...
Show 7 quoted lines
>  int fetch_populated_submodules(const struct argv_array *options,
>  			       const char *prefix, int command_line_option,
> -			       int quiet)
> +			       int quiet, int max_parallel_jobs)
>  {
> -	int i, result = 0;
> -	struct child_process cp = CHILD_PROCESS_INIT;

... together with this one, could have been made easier to follow if you didn't add a new parameter to the function. Instead, you could define a local variable max_parallel_jobs initialized to 1 in this function without changing the function signature (and the caller) in this step, and then did the above two changes in the same commit as the one that actually enables the feature.

That would be more in line with the stated "only adds the possiblity for it" goal.

As posted, I suspect that by passing 0 to max_parallel_jobs, you are telling run_processes_parallel_init() to check online_cpus() and run that many processes in parallel, no?

Show 11 quoted lines
> +int get_next_submodule(void *data, struct child_process *cp,
> +		       struct strbuf *err)
> +{
> +	int ret = 0;
> +	struct submodule_parallel_fetch *spf = data;
> ...
> +			child_process_init(cp);
> +			cp->dir = strbuf_detach(&submodule_path, NULL);
> +			cp->git_cmd = 1;
> +			cp->no_stdout = 1;
> +			cp->no_stdin = 1;

In run-commands.c::start_command(), no_stdout triggers dup_devnull(1) and causes dup2(2, 1) that is triggered by stdout_to_stderrd to be bypassed. This looks wrong to me.

> +			cp->stdout_to_stderr = 1;
> +			cp->err = -1;

OK, the original left the standard error stream connected to the invoker's standard error, but now we are capturing it via a pipe.

Previous: Stefan BellerNext: Stefan Beller
Message 40 of 48 in “[PATCHv3 00/13] fetch submodules in parallel and a preview on parallel "submodule update"”
  1. Stefan BellerSep 21, 2015
  2. 01/13 Sending "Fetching submodule <foo>" output to stderrStefan Beller, Sep 21, 2015
  3. Junio C HamanoSep 21, 2015
  4. 02/13 xread: poll on non blocking fdsStefan Beller, Sep 21, 2015
  5. Junio C HamanoSep 21, 2015
  6. Torsten BögershausenSep 22, 2015
  7. Jacob KellerSep 22, 2015
  8. Torsten BögershausenSep 22, 2015
  9. Junio C HamanoSep 22, 2015
  10. Jeff KingSep 22, 2015
  11. Junio C HamanoSep 22, 2015
  12. Stefan BellerSep 23, 2015
  13. Junio C HamanoSep 23, 2015
  14. Jeff KingSep 23, 2015
  15. Eric SunshineSep 21, 2015
  16. Junio C HamanoSep 22, 2015
  17. Stefan BellerSep 22, 2015
  18. Junio C HamanoSep 22, 2015
  19. Stefan BellerSep 22, 2015
  20. 03/13 xread_nonblock: add functionality to read from fds nonblockinglyStefan Beller, Sep 21, 2015
  21. Junio C HamanoSep 22, 2015
  22. Junio C HamanoSep 22, 2015
  23. Jacob KellerSep 22, 2015
  24. Jacob KellerSep 22, 2015
  25. Junio C HamanoSep 22, 2015
  26. 04/13 strbuf: add strbuf_read_once to read without blockingStefan Beller, Sep 21, 2015
  27. Junio C HamanoSep 22, 2015
  28. Jacob KellerSep 22, 2015
  29. 05/13 run-command: factor out return value computationStefan Beller, Sep 21, 2015
  30. Junio C HamanoSep 22, 2015
  31. 06/13 run-command: add an asynchronous parallel child processorStefan Beller, Sep 21, 2015
  32. Junio C HamanoSep 22, 2015
  33. Stefan BellerSep 22, 2015
  34. Junio C HamanoSep 22, 2015
  35. Stefan BellerSep 22, 2015
  36. Junio C HamanoSep 22, 2015
  37. Stefan BellerSep 22, 2015
  38. Junio C HamanoSep 22, 2015
  39. 07/13 fetch_populated_submodules: use new parallel job processingStefan Beller, Sep 21, 2015
  40. Junio C HamanoSep 22, 2015
  41. 08/13 submodules: allow parallel fetching, add tests and documentationStefan Beller, Sep 21, 2015
  42. 09/13 submodule config: keep update strategy aroundStefan Beller, Sep 21, 2015
  43. Eric SunshineSep 22, 2015
  44. Stefan BellerSep 22, 2015
  45. 10/13 git submodule update: cmd_update_recursiveStefan Beller, Sep 21, 2015
  46. 11/13 git submodule update: cmd_update_cloneStefan Beller, Sep 21, 2015
  47. 12/13 git submodule update: cmd_update_fetchStefan Beller, Sep 21, 2015
  48. 13/13 Rewrite submodule update in CStefan Beller, Sep 21, 2015

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.