Age | Commit message (Collapse) | Author |
|
There is a case to call this function without VM lock acquiring.
|
|
To debug this issue:
https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20201217T220004Z.fail.html.gz
|
|
gc_verify_internal_consistency() accesses all slots (objects) so
all ractors should stop before starting this function.
|
|
objspace->obj_to_id_tbl is a shared table so we need to synchronize
it to access.
Notes:
Merged: https://github.com/ruby/ruby/pull/3924
|
|
mark needs barrier (stop other ractors), but other GC events don't need
barriers (maybe...).
Notes:
Merged: https://github.com/ruby/ruby/pull/3923
|
|
Current synchronization is too much on write barriers.
Notes:
Merged: https://github.com/ruby/ruby/pull/3918
|
|
|
|
Enabled this flag, maybe accidentally.
|
|
|
|
It seems introduce critical problems. Now I could not find
out the issue.
http://ci.rvm.jp/results/trunk-test@ruby-sky1/3286048
|
|
ObjectSpace._id2ref(id) can return any objects even if they are
unshareable, so this patch raises RangeError if it runs on multi-ractor
mode and the found object is unshareable.
Notes:
Merged: https://github.com/ruby/ruby/pull/3878
|
|
|
|
Per ractor method cache (GH-#3842) only cached 1 page and this patch
caches several pages to keep at least 512 free slots if available.
If you increase the number of cached free slots, all cached slots
will be collected when the GC is invoked.
Notes:
Merged: https://github.com/ruby/ruby/pull/3875
|
|
A program with multiple ractors can consume more objects per
unit time, so this patch set minimum/maximum free_slots to
relative to ractors count (upto 8).
Notes:
Merged: https://github.com/ruby/ruby/pull/3875
|
|
Lazy sweep tries to collect free (unused) slots incrementally, and
it only collect a few pages. This patch makes lazy sweep collects
more objects (at least 2048 objects) and GC overhead of multi-ractor
execution will be reduced.
Notes:
Merged: https://github.com/ruby/ruby/pull/3875
|
|
Checking code (RGENGC_CHECK_MODE > 0) need a VM lock because it
refers objspace.
|
|
Some data should be accessed in parallel so they should be protected
by the lock.
|
|
Write barrier requires VM lock because it accesses VM global bitmap
but RB_VM_LOCK_ENTER() can invoke GC because another ractor can wait
to invoke GC and RB_VM_LOCK_ENTER() is barrier point. This means that
before protecting by a write barrier, GC can invoke.
To prevent such situation, RB_VM_LOCK_ENTER_NO_BARRIER() is introduced.
This lock primitive does not become GC barrier points.
|
|
This assertion is not considerred on multi-ractor mdoe.
|
|
NEWOBJ with current ec.
Notes:
Merged: https://github.com/ruby/ruby/pull/3842
|
|
Now object allocation requires VM global lock to synchronize objspace.
However, of course, it introduces huge overhead.
This patch caches some slots (in a page) by each ractor and use cached
slots for object allocation. If there is no cached slots, acquire the global lock
and get new cached slots, or start GC (marking or lazy sweeping).
Notes:
Merged: https://github.com/ruby/ruby/pull/3842
|
|
This seems to be breaking the build for some reason.
This command can reproduce it:
`make yes-test-all TESTS=--repeat-count=20`
This reverts commit 88bb1a672c49746972f4b15410fa92e9d237c43d.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3843
|
|
When we allocate new pages, allocate them on the end of the linked list.
Then when we compact we can move things to the head of the list
Notes:
Merged: https://github.com/ruby/ruby/pull/3814
|
|
Incremental sweeping should sweep until we find a slot for objects to
use. `heap_increment` was adding a page to the heap even though we
would sweep immediately after.
Co-authored-by: John Hawthorn <john@hawthorn.email>
Notes:
Merged: https://github.com/ruby/ruby/pull/3837
|
|
|
|
To manage ractor-local data for C extension, the following APIs
are defined.
* rb_ractor_local_storage_value_newkey
* rb_ractor_local_storage_value
* rb_ractor_local_storage_value_set
* rb_ractor_local_storage_ptr_newkey
* rb_ractor_local_storage_ptr
* rb_ractor_local_storage_ptr_set
At first, you need to create a key of storage by
rb_ractor_local_(value|ptr)_newkey().
For ptr storage, it accepts the type of storage,
how to mark and how to free with ractor's lifetime.
rb_ractor_local_storage_value/set are used to access a VALUE
and rb_ractor_local_storage_ptr/set are used to access a pointer.
random.c uses this API.
Notes:
Merged: https://github.com/ruby/ruby/pull/3822
|
|
read_barrier_handler() can cause SIGSEGV/BUS so it should show
the errors.
|
|
Unfortunately we couldn't see a C backtrace with the previous commit
http://ci.rvm.jp/results/trunk-random2@phosphorus-docker/3272697.
|
|
when GC.compact's SEGV handler is installed
|
|
Both explicit compaction routines (gc_compact and the verify references form)
need to clear the heap before executing compaction. Otherwise some
objects may not be alive, and we'll need the read barrier. The heap
must only contain *live* objects if we want to disable the read barrier
during explicit compaction.
The previous commit was missing the "clear the heap" phase from the
"verify references" explicit compaction function.
Fixes [Bug #17306]
|
|
This reverts commit 63ad55cd882e4010fe313d271af006a430b5ffa8.
Revert "Disable read barrier on explicit compaction request"
This reverts commit 490b57783d80f0c5f7882c66d9fb6aa02713c9a5.
|
|
Auto Compaction uses mprotect to implement a read barrier. mprotect can
only work on regions of memory that are a multiple of the OS page size.
Ruby's pages are a multiple of 4kb, but some platforms (like ppc64le)
don't have 4kb page sizes. This commit disables the features on those
platforms.
Fixes [Bug #17306]
|
|
|
|
We don't need a read barrier when the user calls `GC.compact` because we
don't allow allocations during GC, and all references should be "live"
Notes:
Merged: https://github.com/ruby/ruby/pull/3809
|
|
To make some kind of Ractor related extensions, some functions
should be exposed.
* include/ruby/thread_native.h
* rb_native_mutex_*
* rb_native_cond_*
* include/ruby/ractor.h
* RB_OBJ_SHAREABLE_P(obj)
* rb_ractor_shareable_p(obj)
* rb_ractor_std*()
* rb_cRactor
and rm ractor_pub.h
and rename srcdir/ractor.h to srcdir/ractor_core.h
(to avoid conflict with include/ruby/ractor.h)
Notes:
Merged: https://github.com/ruby/ruby/pull/3775
|
|
|
|
|
|
Combine everything in to one C function
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3734
|
|
* `GC.auto_compact=`, `GC.auto_compact` can be used to control when
compaction runs. Setting `auto_compact=` to true will cause
compaction to occurr duing major collections. At the moment,
compaction adds significant overhead to major collections, so please
test first!
[Feature #17176]
|
|
This patch allows to move more data types.
Notes:
Merged: https://github.com/ruby/ruby/pull/3727
|
|
It's not necessary to check ivpt because objects are allocated as
"embedded" by default
|
|
Same as 5be42c1ef4f7ed0a8004cad750a9ce61869bd768
|
|
As of 0b81a484f3453082d28a48968a063fd907daa5b5, `ROBJECT_IVPTR` will
always return a value, so we don't need to test whether or not we got
one. T_OBJECTs always come to life as embedded objects, so they will
return an ivptr, and when they become "unembedded" they will have an
ivptr at that point too
|
|
We don't need to check the existence if an ivptr because non-embedded
objects will always have one
|
|
We are seeing an error where code that is generated with MJIT contains
references to objects that have been moved. I believe this is due to a
race condition in the compaction function.
`gc_compact` has two steps:
1. Run a full GC to pin objects
2. Compact / update references
Step one is executed with `garbage_collect`. `garbage_collect` calls
`gc_enter` / `gc_exit`, these functions acquire a JIT lock and release a
JIT lock. So a lock is held for the duration of step 1.
Step two is executed by `gc_compact_after_gc`. It also holds a JIT
lock.
I believe the problem is that the JIT is free to execute between step 1
and step 2. It copies call cache values, but doesn't pin them when it
copies them. So the compactor thinks it's OK to move the call cache
even though it is not safe.
We need to hold a lock for the duration of `garbage_collect` *and*
`gc_compact_after_gc`. This patch introduces a lock level which
increments and decrements. The compaction function can increment and
decrement the lock level and prevent MJIT from executing during both
steps.
Notes:
Merged: https://github.com/ruby/ruby/pull/3683
|
|
rb_objspace_reachable_objects_from(obj) is used to traverse all
reachable objects from obj. This function modify objspace but it
is not ractor-safe (thread-safe). This patch fix the problem.
Strategy:
(1) call GC mark process during_gc
(2) call Ractor-local custom mark func when !during_gc
Notes:
Merged: https://github.com/ruby/ruby/pull/3680
|
|
Unshareable objects should not be touched from multiple ractors
so ObjectSpace.each_object should be restricted. On multi-ractor
mode, ObjectSpace.each_object only iterates shareable objects.
[Feature #17270]
Notes:
Merged: https://github.com/ruby/ruby/pull/3672
|