public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	 'GNU C Library' <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2 3/4] Move libio lock single-thread optimization to generic libc-lock (BZ #27842)
Date: Mon, 16 May 2022 18:23:40 +0200	[thread overview]
Message-ID: <871qwtqwdv.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <DB6PR0801MB1879AEB2A30B049CCC074CBF83CA9@DB6PR0801MB1879.eurprd08.prod.outlook.com> (Wilco Dijkstra's message of "Mon, 16 May 2022 16:17:11 +0000")

* Wilco Dijkstra:

> Hi Adhemerval,
>
>> The main problem is _IO_enable_locks is a clunky interface because it requires
>> flockfile to set _flags2 outside a lock region leading a possible racy issue 
>> (BZ #27842).  Moving to lock itself it will pretty much:
>
> It should be fine if we use a boolean instead of a flag. IIRC the IO
> structure was externally exposed in Emacs, but if that is no longer
> the case then we could change the structure safely.

gnulib has code that directly _flags (not _flags2).  gnulib is
statically linked, which makes for a long transition time.

>> I think ideally we would like to model all internal locks to a futex-like
>> so we can use the congestion optimization as described by Jens Gustedt
>> paper [1] which would allows us to move the counter and the lock to
>> same word.  I don't think we can improve recursive locks without a 64-bit
>> futex operation. 
>
> How much lock recursion exists in GLIBC? An 8-bit counter is likely
> sufficient...

One of the loader logs is recursive, and dlopen calls can be nested
basically arbitrarily deeply in ELF constructors.

Thanks,
Florian


  reply	other threads:[~2022-05-16 16:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29 13:04 Wilco Dijkstra
2022-04-29 17:13 ` Adhemerval Zanella
2022-05-16 16:17   ` Wilco Dijkstra
2022-05-16 16:23     ` Florian Weimer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-04-26 19:15 [PATCH v2 0/4] Move libio lock single-thread optimization to generic libc-lock Adhemerval Zanella
2022-04-26 19:15 ` [PATCH v2 3/4] Move libio lock single-thread optimization to generic libc-lock (BZ #27842) Adhemerval Zanella
2022-04-27 13:30   ` Florian Weimer
2022-04-27 16:32     ` Adhemerval Zanella
2022-04-28 16:39       ` Adhemerval Zanella
2022-04-28 16:56         ` Florian Weimer
2022-04-28 17:14           ` Adhemerval Zanella

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qwtqwdv.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /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.
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).