unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: last_marked array is now ifdef'ed away
Date: Sat, 14 Sep 2024 19:05:31 +0200	[thread overview]
Message-ID: <AEA4306D-3D9C-414A-A58E-2F0C68443257@gmail.com> (raw)
In-Reply-To: <86a5gbk295.fsf@gnu.org>

13 sep. 2024 kl. 17.21 skrev Eli Zaretskii <eliz@gnu.org>:

> But if a user reports a crash inside GC, that's basically the only
> trace we have to try and understand what caused the crash, especially
> if the debug info was stripped.  That's why this code was always on by
> default.

Yes, I understand that -- nevertheless it is a bit of a waste to spend time on something that is only rarely used (apparently it took over 2 years before anyone noticed, and I know you aren't one for keeping quiet about this sort of thing).

It surprised me how expensive this silly thing is: enabling GC_REMEMBER_LAST_MARKED made GC 4.5-6.5 % slower in some simple benchmarks, and the difference showed up in some actual useful work type of code that I measured.

And that is with LAST_MARKED_SIZE downgraded from the default 512 to just 16 which seemed more reasonable. (512 entries is 4 KiB of L1D cache which seems extravagant, but I presume the size wasn't given much thought at the time.)

Perhaps it's not a big surprise after all: the GC marking loop has data-dependent branches and data-dependent loads, and we are likely to be bound by instructions in flight rather than execution resources; maybe any added instructions and memory traffic will just make it worse.

> My main concern is not bitrot, it's actually being able to debug
> crashes inside GC.

I'm quite sympathetic to that goal but it would be good if we could do it more cheaply. You can inspect the mark_stack structure; I've found this to help quite a bit.




  reply	other threads:[~2024-09-14 17:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-07  6:05 last_marked array is now ifdef'ed away Eli Zaretskii
2024-09-12  9:19 ` Eli Zaretskii
2024-09-13 14:43   ` Mattias Engdegård
2024-09-13 15:21     ` Eli Zaretskii
2024-09-14 17:05       ` Mattias Engdegård [this message]
2024-09-14 17:30         ` Eli Zaretskii
2024-09-14 20:30           ` Mattias Engdegård
2024-09-15  5:51             ` Eli Zaretskii
2024-09-15 13:58               ` Mattias Engdegård
2024-09-15 14:21                 ` Eli Zaretskii
2024-09-17 10:15                   ` Mattias Engdegård
2024-09-17 13:22                     ` Eli Zaretskii
2024-09-14 22:50           ` Stefan Kangas
2024-09-15  6:01             ` Eli Zaretskii
2024-09-16 18:07               ` Andrea Corallo

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: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=AEA4306D-3D9C-414A-A58E-2F0C68443257@gmail.com \
    --to=mattias.engdegard@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).