Project

General

Profile

Actions

Bug #9225

closed

[patch] add WB to NODE_CREF

Added by tmm1 (Aman Karmani) almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Target version:
ruby -v:
trunk
[ruby-core:58947]

Description

In our rails app, there are a lot of long-lived NODE_CREF:

p ObjectSpace.count_nodes
=> {:NODE_IF=>3, :NODE_CREF=>45810, :NODE_IFUNC=>11}

These are static objects, but are considered SHADY and contribute to the size of the remembered set:

GC.stat[:remembered_shady_object]
=> 49667

With the following patch, NODE_CREF are no longer shady and can be promoted: https://github.com/tmm1/ruby/commit/c5e8341

This reduces the size of the remembered set in our app, and speeds up minor GC from 22ms to 18ms per run.
After the patch:

GC.stat[:remembered_shady_object]
=> 10506

The patch is passing make test-all with RGENGC_CHECK=2

Actions #1

Updated by tmm1 (Aman Karmani) almost 11 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r44059.
Aman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


gc.c: promote long-lived NODE_CREF objects to oldgen

  • include/ruby/ruby.h: add RGENGC_WB_PROTECTED_NODE_CREF setting
    In a large app, this reduces the size of
    remembered_shady_object_count by 80%. [Bug #9225] [ruby-core:58947]
  • gc.c (rb_node_newnode): add FL_WB_PROTECTED flag to NODE_CREF
  • class.c (rewrite_cref_stack): insert OBJ_WRITE for NODE_CREF
  • iseq.c (set_relation): ditto
  • iseq.c (rb_iseq_clone): ditto
  • vm_eval.c (rb_yield_refine_block): ditto
  • vm_insnhelper.c (vm_cref_push): ditto
  • vm_insnhelper.h (COPY_CREF): ditto
Actions

Also available in: Atom PDF

Like0
Like0