git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Sandor Bodo-Merle <sbodomerle@gmail.com>,
	Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] read-cache: fix mem-pool allocation for multi-threaded index loading
Date: Fri, 4 Sep 2020 12:28:17 -0700	[thread overview]
Message-ID: <CABPp-BGQA98SOr4-+8LKd-V=oqB98hoDGh+AsvOGHjsM2ko=iA@mail.gmail.com> (raw)
In-Reply-To: <dbccbf13-9ebb-2464-4325-cac4c7767f74@web.de>

On Fri, Sep 4, 2020 at 10:34 AM René Scharfe <l.s.r@web.de> wrote:
>
> 44c7e1a7e0 (mem-pool: use more standard initialization and finalization,
> 2020-08-15) moved the allocation of the mem-pool structure to callers.
> It also added an allocation to load_cache_entries_threaded(), but for an
> unrelated mem-pool.  Fix that by allocating the correct one instead --
> the one that is initialized two lines later.

Whoops; that's a somewhat embarrassing mistake.  Thanks for fixing it up for me.

Reviewed-by: Elijah Newren <newren@gmail.com>

>
> Reported-by: Sandor Bodo-Merle <sbodomerle@gmail.com>
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
> "GIT_TEST_INDEX_THREADS=3 make test" passes with this patch, but fails a
> lot without it.
>
>  read-cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/read-cache.c b/read-cache.c
> index fa291cdbee..ecf6f68994 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -2101,7 +2101,7 @@ static unsigned long load_cache_entries_threaded(struct index_state *istate, con
>                 nr = 0;
>                 for (j = p->ieot_start; j < p->ieot_start + p->ieot_blocks; j++)
>                         nr += p->ieot->entries[j].nr;
> -               istate->ce_mem_pool = xmalloc(sizeof(*istate->ce_mem_pool));
> +               p->ce_mem_pool = xmalloc(sizeof(*istate->ce_mem_pool));
>                 if (istate->version == 4) {
>                         mem_pool_init(p->ce_mem_pool,
>                                 estimate_cache_size_from_compressed(nr));
> --
> 2.28.0

      reply	other threads:[~2020-09-04 19:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 14:08 possible segfault wint index threading Sandor Bodo-Merle
2020-09-04 17:33 ` [PATCH] read-cache: fix mem-pool allocation for multi-threaded index loading René Scharfe
2020-09-04 19:28   ` Elijah Newren [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

  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='CABPp-BGQA98SOr4-+8LKd-V=oqB98hoDGh+AsvOGHjsM2ko=iA@mail.gmail.com' \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    --cc=sbodomerle@gmail.com \
    /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).