GNU bug report logs - #39361
continuation and gc performance

Previous Next

Package: guile;

Reported by: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>

Date: Thu, 30 Jan 2020 21:12:01 UTC

Severity: normal

To reply to this bug, email your comments to 39361 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#39361; Package guile. (Thu, 30 Jan 2020 21:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Thu, 30 Jan 2020 21:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: continuation and gc performance
Date: Thu, 30 Jan 2020 22:10:50 +0100
[Message part 1 (text/plain, inline)]
I think I found a gc leak in guile 3.0

Isn't it so that so the continuation keep a copy of the stack. The issue is
that in the stack a raw integer or float may be present and so the gc
properties is less then ideal as those may be interpreted as pointers by
the GC and lead to parts of the heap being kept from garnage collecting.

The information about a slot being a raw value or a scm value is
available as we do the correct gc updating of the stack inside guile 3.0.
May I propose that we add a bitvector to the continuation that indicate
that if a lslot is raw or not. Then add a pass that collect the rawness
information in the creation of the closure. Finally a custom made mark
procedure for closures can be made that uses all this information to make
sure to mark only scm slots in the stored continuation therby improving gc
perfromance.

With this information it would also be possible to serialize continuations
even if they have slots that are raw values.

Happy Hacking
[Message part 2 (text/html, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#39361; Package guile. (Sat, 21 Mar 2020 17:34:02 GMT) Full text and rfc822 format available.

Message #8 received at 39361 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
Cc: 39361 <at> debbugs.gnu.org
Subject: Re: bug#39361: continuation and gc performance
Date: Sat, 21 Mar 2020 18:33:41 +0100
Hi Stefan,

Stefan Israelsson Tampe <stefan.itampe <at> gmail.com> skribis:

> I think I found a gc leak in guile 3.0
>
> Isn't it so that so the continuation keep a copy of the stack. The issue is
> that in the stack a raw integer or float may be present and so the gc
> properties is less then ideal as those may be interpreted as pointers by
> the GC and lead to parts of the heap being kept from garnage collecting.
>
> The information about a slot being a raw value or a scm value is
> available as we do the correct gc updating of the stack inside guile 3.0.
> May I propose that we add a bitvector to the continuation that indicate
> that if a lslot is raw or not. Then add a pass that collect the rawness
> information in the creation of the closure. Finally a custom made mark
> procedure for closures can be made that uses all this information to make
> sure to mark only scm slots in the stored continuation therby improving gc
> perfromance.

I believe what you describe is already what happens in
‘scm_i_vm_mark_stack’.  Or am I missing something?

Thanks,
Ludo’.




Information forwarded to bug-guile <at> gnu.org:
bug#39361; Package guile. (Sat, 21 Mar 2020 20:45:02 GMT) Full text and rfc822 format available.

Message #11 received at 39361 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 39361 <at> debbugs.gnu.org
Subject: Re: bug#39361: continuation and gc performance
Date: Sat, 21 Mar 2020 21:43:49 +0100
[Message part 1 (text/plain, inline)]
That function marks the working stack no, what about stack segments in
continuations will they be marked correctly as well?

On Sat, Mar 21, 2020 at 6:33 PM Ludovic Courtès <ludo <at> gnu.org> wrote:

> Hi Stefan,
>
> Stefan Israelsson Tampe <stefan.itampe <at> gmail.com> skribis:
>
> > I think I found a gc leak in guile 3.0
> >
> > Isn't it so that so the continuation keep a copy of the stack. The issue
> is
> > that in the stack a raw integer or float may be present and so the gc
> > properties is less then ideal as those may be interpreted as pointers by
> > the GC and lead to parts of the heap being kept from garnage collecting.
> >
> > The information about a slot being a raw value or a scm value is
> > available as we do the correct gc updating of the stack inside guile 3.0.
> > May I propose that we add a bitvector to the continuation that indicate
> > that if a lslot is raw or not. Then add a pass that collect the rawness
> > information in the creation of the closure. Finally a custom made mark
> > procedure for closures can be made that uses all this information to make
> > sure to mark only scm slots in the stored continuation therby improving
> gc
> > perfromance.
>
> I believe what you describe is already what happens in
> ‘scm_i_vm_mark_stack’.  Or am I missing something?
>
> Thanks,
> Ludo’.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#39361; Package guile. (Sun, 22 Mar 2020 20:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 39361 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
Cc: 39361 <at> debbugs.gnu.org
Subject: Re: bug#39361: continuation and gc performance
Date: Sun, 22 Mar 2020 21:51:31 +0100
Hi,

Stefan Israelsson Tampe <stefan.itampe <at> gmail.com> skribis:

> That function marks the working stack no, what about stack segments in
> continuations will they be marked correctly as well?

Oh you’re right, from a quick look at continuations.c, a continuation’s
stack appears to be conservatively scanned (allocated with
‘scm_gc_malloc’).

My intuition is that it’s “good enough” in most cases, but could affect
GC performance a tiny bit in continuation-heavy code, such as Fibers.

Ludo’.




This bug report was last modified 5 years and 83 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.