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

Re: [PATCHv2] attr: convert to new threadsafe API

From
Stefan Beller <sbeller@google.com>
Date
Oct 12, 2016, 21:42 UTC
Message-ID
<CAGZ79kb-xKDNG-LC56i8Y-FAaYZwr8zzXuC9snj1PavnQ6cdCA@mail.gmail.com>
In-Reply-To
<xmqq8ttt2qpp.fsf@gitster.mtv.corp.google.com>
On Wed, Oct 12, 2016 at 2:38 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes:
>
>> Sigh. DCLP, the Double Checked Locking Pattern. ...
>> I suggest you go without it, then measure, and only *then* optimize if
>> it is a bottleneck.
>
> That comes from me in earlier discussion before the patch, namely in
> <xmqqeg3m8y6y.fsf@gitster.mtv.corp.google.com>, where I wondered if
> a cheap check outside the lock may be a possible optimization
> opportunity, as this is a classic singleton that will not be
> deinitialized, and once the codepath gets exercised, we would be
> taking the "nothing to do" route 100% of the time.
>

Having followed that advice (and internally having a DCLP), I think we have Triple Checked Locking Pattern in this patch. Nobody wrote a paper on how that would not work, yet. ;)

In the reroll I plan to reduce it to a Single Checked (inside a mutex) Locking Pattern, though I would expect that performance (or lack thereof) will show then. But let's postpone measuring until we have a working patch.

Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 16 in “[PATCHv2] attr: convert to new threadsafe API”
  1. Stefan BellerOct 11, 2016
  2. Junio C HamanoOct 12, 2016
  3. Stefan BellerOct 12, 2016
  4. Junio C HamanoOct 12, 2016
  5. Stefan BellerOct 12, 2016
  6. Junio C HamanoOct 12, 2016
  7. Junio C HamanoOct 12, 2016
  8. Johannes SixtOct 12, 2016
  9. Junio C HamanoOct 12, 2016
  10. Stefan BellerOct 12, 2016
  11. Junio C HamanoOct 12, 2016
  12. Jacob KellerOct 12, 2016
  13. Stefan BellerOct 12, 2016
  14. Junio C HamanoOct 12, 2016
  15. Stefan BellerOct 12, 2016
  16. Junio C HamanoOct 12, 2016

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.