public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tnfchris at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/107675] [13 Regression] GCC-13 is significantly slower to startup on C++ programs
Date: Sun, 20 Nov 2022 23:57:20 +0000	[thread overview]
Message-ID: <bug-107675-4-qd7tGpuWKL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107675-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107675

--- Comment #10 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
I've bisected this to:

commit 6e80a1d164d1f996ad08a512c000025a7c2ca893
Author: Thomas Neumann <tneumann@users.sourceforge.net>
Date:   Tue Mar 1 21:57:35 2022 +0100

    eliminate mutex in fast path of __register_frame

    The __register_frame/__deregister_frame functions are used to register
    unwinding frames from JITed code in a sorted list. That list itself
    is protected by object_mutex, which leads to terrible performance
    in multi-threaded code and is somewhat expensive even if single-threaded.
    There was already a fast-path that avoided taking the mutex if no
    frame was registered at all.

    This commit eliminates both the mutex and the sorted list from
    the atomic fast path, and replaces it with a btree that uses
    optimistic lock coupling during lookup. This allows for fully parallel
    unwinding and is essential to scale exception handling to large
    core counts.

    libgcc/ChangeLog:

            * unwind-dw2-fde.c (release_registered_frames): Cleanup at
shutdown.
            (__register_frame_info_table_bases): Use btree in atomic fast path.
            (__deregister_frame_info_bases): Likewise.
            (_Unwind_Find_FDE): Likewise.
            (base_from_object): Make parameter const.
            (classify_object_over_fdes): Add query-only mode.
            (get_pc_range): Compute PC range for lookup.
            * unwind-dw2-fde.h (last_fde): Make parameter const.
            * unwind-dw2-btree.h: New file.

 libgcc/unwind-dw2-btree.h | 953 ++++++++++++++++++++++++++++++++++++++++++++++
 libgcc/unwind-dw2-fde.c   | 194 +++++++---
 libgcc/unwind-dw2-fde.h   |   2 +-
 3 files changed, 1098 insertions(+), 51 deletions(-)
 create mode 100644 libgcc/unwind-dw2-btree.h

Looking at the patch it looks like it now forces an eager registration of
objects during frame registration vs a lazy initialization that was there
before.

  parent reply	other threads:[~2022-11-20 23:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 13:03 [Bug libstdc++/107675] New: " tnfchris at gcc dot gnu.org
2022-11-14 13:09 ` [Bug libstdc++/107675] " tnfchris at gcc dot gnu.org
2022-11-14 13:20 ` jakub at gcc dot gnu.org
2022-11-14 13:27 ` fw at gcc dot gnu.org
2022-11-14 14:28 ` tnfchris at gcc dot gnu.org
2022-11-14 17:54 ` pinskia at gcc dot gnu.org
2022-11-14 17:55 ` pinskia at gcc dot gnu.org
2022-11-17 11:04 ` tnfchris at gcc dot gnu.org
2022-11-17 11:15 ` fw at gcc dot gnu.org
2022-11-17 11:24 ` tnfchris at gcc dot gnu.org
2022-11-20 23:57 ` tnfchris at gcc dot gnu.org [this message]
2022-11-20 23:58 ` [Bug libgcc/107675] " tnfchris at gcc dot gnu.org
2022-11-22  9:35 ` tnfchris at gcc dot gnu.org
2022-12-09 19:56 ` [Bug libgcc/107675] [13 Regression] GCC-13 is significantly slower to startup on C++ statically linked programs m.cencora at gmail dot com
2022-12-09 22:46 ` tneumann at users dot sourceforge.net
2022-12-16 23:55 ` tneumann at users dot sourceforge.net
2022-12-20 15:38 ` rguenth at gcc dot gnu.org

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=bug-107675-4-qd7tGpuWKL@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).