git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Patrick Hogg <phogg@novamoon.net>,
	Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jeff King <peff@peff.net>
Subject: Re: [PATCH v2] pack-objects: Use packing_data lock instead of read_mutex
Date: Tue, 22 Jan 2019 09:52:49 -0800	[thread overview]
Message-ID: <CABPp-BFmHkf3ftgKxEA5tx_fngPu7WypP_aYyYUvNVmrAibqtw@mail.gmail.com> (raw)
In-Reply-To: <CACsJy8AWCP+enBVVVga7jJZ-gxD=fxcushrk0D+xGSRAcZw_qg@mail.gmail.com>

On Mon, Jan 21, 2019 at 2:02 AM Duy Nguyen <pclouds@gmail.com> wrote:
>
> On Sat, Jan 19, 2019 at 10:45 PM Patrick Hogg <phogg@novamoon.net> wrote:
> >
> > ac77d0c37 ("pack-objects: shrink size field in struct object_entry",
> > 2018-04-14) added an extra usage of read_lock/read_unlock in the newly
> > introduced oe_get_size_slow for thread safety in parallel calls to
> > try_delta(). Unfortunately oe_get_size_slow is also used in serial
> > code, some of which is called before the first invocation of
> > ll_find_deltas. As such the read mutex is not guaranteed to be
> > initialized.
> >
> > Resolve this by using the existing lock in packing_data which is
> > initialized early in cmd_pack_objects instead of read_mutex.
> > Additionally, upgrade the packing_data lock to a recursive mutex to
> > make it a suitable replacement for read_mutex.
> >
> > Signed-off-by: Patrick Hogg <phogg@novamoon.net>
> > ---
> >
> > As I mentioned in the prior thread I think that it will be simpler
> > to simply use the existing lock in packing_data instead of moving
> > read_mutex. I can go back to simply moving read_mutex to the
> > packing_data struct if that that is preferable, though.
>
> In early iterations of these changes, I think we hit high contention
> when sharing the mutex [1]. I don't know if we will hit the same
> performance problem again with this patch. It would be great if Elijah
> with his zillion core machine could test this out. Otherwise it may be
> just safer to keep the two mutexes separate.

Testing...

  parent reply	other threads:[~2019-01-22 17:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-19 15:43 [PATCH v2] pack-objects: Use packing_data lock instead of read_mutex Patrick Hogg
2019-01-21 10:02 ` Duy Nguyen
2019-01-22  7:28   ` Jeff King
2019-01-22 10:25     ` Duy Nguyen
2019-01-22 13:13       ` Patrick Hogg
2019-01-22 17:52   ` Elijah Newren [this message]
2019-01-22 20:37     ` Elijah Newren
2019-01-22 22:43 ` Junio C Hamano
2019-01-22 23:54   ` Patrick Hogg
2019-01-23 17:51     ` Junio C Hamano

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-BFmHkf3ftgKxEA5tx_fngPu7WypP_aYyYUvNVmrAibqtw@mail.gmail.com \
    --to=newren@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=phogg@novamoon.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).