Age | Commit message (Collapse) | Author |
|
The multiplication of two bignums is specially optimized when the two
operands have the same address, because squaring can be done more
efficiently than multiplication of two arbitrary integers. That is,
expressions such as `I * I` will be calculated by squaring the value
of `I`.
The optimized function for squaring would read one word beyond the
end of the bignum in the last iteration of a loop. The garbage
value would never be used. In almost all circumstances that would
be harmless. Only if the read word happened to fall on the start
of an unmapped page would the runtime crash. That is unlikely
to happen because most bignums are stored on a process heap, and
since the stack is located at the other end of the block that the
heap is located in, the word beyond the end of bignum is guaranteed
to be readable.
|
|
* lukas/OTP-21.1.1/scheduler_pollset/OTP-15475:
erts: Move fds with active true behaviour to own pollset
erts: Fix lists_member_2 reduction count
erts: Allow code_model_small to be set in xcomp setting
erts: Implement delay_send using timer instead of poll
erts: Optimize driver_set_timer(0) to fire at once
erts: Optimize the inet driver multi timers for one timer
erts: Move all inet tcp CONNECTED timers to multi timer
erts: Add erts_io_notify_port_task_executed to check_io msacc state
erts: Add pre-alloc to ALLOC msacc state
erts: Make thr prgr wakeup current or sched 1
erts: Pass thread progress data where possible
|
|
At start of the VM a poll-set that the schedulers
will check is created where fds that have triggered
many (at the moment, many means 10) times without
being deselected inbetween. In this scheduler specific
poll-set fds do not use ONESHOT, which means that the
number of syscalls goes down dramatically for such fds.
This pollset is introduced in order to handle fds that
are used by the erlang distribution and that never
change their state from {active, true}.
This pollset only handles ready_input events,
ready_output is still handled by the poll threads.
During overload, polling the scheduler poll-set is done
on a 10ms timer.
|
|
A copy has to be made of the message as there is
a trace token. There was a bug where the actual
message was incorrectly modified even if it was a
literal.
|
|
|
|
OTP-15474
|
|
By optimizing driver_set_timer for 0 we can use it
instead of select to do a yield in the driver.
Use full for delay_send in the inet driver.
OTP-15472
|
|
OTP-15450
|
|
* lukas/erts/fix-msacc-gc-states/OTP-15450:
erts: Fix msacc GC states on dirty scheds
|
|
erts: fix attempt to start timer when executing on dirty scheduler
OTP-15446
|
|
Since OTP R20, there is a possibility for MAJOR garbage collection to
run on dirty scheduler. So DistEntry destructor is being called on
dirty scheduler as well. This, in turn, leads to an attempt to schedule
timer on a dirty scheduler too, which is impossible (and will assert
on debug build, but does succeed for release build, creating an
infinite busy loop, since aux work wakes scheduler up, but dirty
scheduler cannot execute aus work).
There is a similar method in erl_hl_timer, see erts_start_timer_callback.
|
|
* sverker/erts/atomics-counters/OTP-13468:
erts: Fix bug in counters
erts: Refactor erl_bif_counters.c
|
|
Wow, that could have been embarrassing.
|
|
with more consistent naming.
|
|
into maint
* john/erts/spectre-configure-flag-otp_20/OTP-15430/ERIERL-237:
Allow disabling retpoline in interpreter loop
Add a ./configure flag for spectre mitigation
|
|
AGAIN
* sverker/erts/atomics-counters/OTP-13468:
erts: Add counters:put/3
|
|
|
|
john/erts/spectre-configure-flag-otp_20/OTP-15430/ERIERL-237
* john/erts/spectre-configure-flag/OTP-15430/ERIERL-237:
Allow disabling retpoline in interpreter loop
Add a ./configure flag for spectre mitigation
|
|
We only do this when the user has explicitly told us it's okay to
partially disable mitigation (spectre-mitigation=incomplete). The
macro is inert if it isn't.
|
|
* john/erts/defer-orphan-file-close/OTP-15421/ERIERL-261:
Fix broken assertion on monitor release
Avoid closing files in gc/monitor callbacks
|
|
* sverker/erts/atomics-counters/OTP-13468:
erts: Add new module 'counters'
erts: Add new module 'atomics'
|
|
|
|
|
|
We sometimes bump the refc without messing with the table, which
means that we sometimes decrement it while in the table, causing
the old assertion to fail.
The property we want to check is that neither end of the monitor is
present in the table when the monitor is deleted.
|
|
Now that it traps, --/2 would hang forever when building under
--enable-dirty-schedulers-test.
|
|
* bjorn/erts/persistent_terms/OTP-14669:
Implement a tab for persistent terms in crashdump viewer
Add tests of persistent terms for crashdump_viewer
Add a persistent term storage
Refactor releasing of literals
Extend the sharing-preserving routines to optionally copy literals
|
|
Persistent terms are useful for storing Erlang terms that are never
or infrequently updated. They have the following advantages:
* Constant time access. A persistent term is not copied when it is
looked up. The constant factor is lower than for ETS, and no locks
are taken when looking up a term.
* Persistent terms are not copied in garbage collections.
* There is only ever one copy of a persistent term (until it is
deleted). That makes them useful for storing configuration data
that needs to be easily accessible by all processes.
Persistent terms have the following drawbacks:
* Updates are expensive. The hash table holding the keys for the
persistent terms are updated whenever a persistent term is added,
updated or deleted.
* Updating or deleting a persistent term triggers a "global GC", which
will schedule a heap scan of all processes to search the heap of all
processes for the deleted term. If a process still holds a reference
to the deleted term, the process will be garbage collected and the
term copied to the heap of the process. This global GC can make the
system less responsive for some time.
Three BIFs (implemented in C in the emulator) is the entire
interface to the persistent term functionality:
* put(Key, Value) to store a persistent term.
* get(Key) to look up a persistent term.
* erase(Key) to delete a persistent term.
There are also two additional BIFs to obtain information about
persistent terms:
* info() to return a map with information about persistent terms.
* get() to return a list of a {Key,Value} tuples for all persistent
terms. (The values are not copied.)
|
|
A dirty scheduler is an un-managed thread so we need to
lock the msacc state on those.
|
|
* john/erts/minusminus_trapping/OTP-15371:
Optimize operator '--' and yield on large inputs
Inline erts_cmp
Clarify a magical allocation size
Fix trapping in lists:reverse/2
|
|
* rickard/internal_ref_cmp/OTP-15399/ERL-751:
Fix erts_internal_ref_number_cmp()
|
|
|
|
Introudce erts_queue_release_literals() to queue a literal area to be
released.
|
|
The removal set now uses a red-black tree instead of an array on
large inputs, decreasing runtime complexity from `n*n` to
`n*log(n)`. It will also exit early when there are no more items
left in the removal set, drastically improving performance and
memory use when the items to be removed are present near the head
of the list.
This got a lot more complicated than before as the overhead of
always using a red-black tree was unacceptable when either of the
inputs were small, but this compromise has okay-to-decent
performance regardless of input size.
Co-authored-by: Dmytro Lytovchenko <[email protected]>
|
|
This greatly increases the performance of '--'/2 which does a lot
of term comparisons.
|
|
|
|
The first stage wasn't bounded by reductions, and it bumped far
more reductions than it should have due to a logic bug.
|
|
In the implementation of the zero-copying term storage, we
want to preserve sharing, but not copy literals because the
modules holding the literals could be unloaded under our feet.
|
|
Before this change, it was always the aux thread that was woken
to handle thread progress events scheduled to happen when all
schedulers were going to sleep. This was ok in the pre-OTP-21
implementation when the aux thread just slept on a tse. Now that
it sleeps in the fallback pollset this uses too much cpu so
instead we wake the thread that is doing the request if it is
a managed thread, or else we wake scheduler 1.
|
|
The poll thread does a lot of waking up and then going
back to sleep. A large part of the waking up is managing
thread progress and a large part of that was using thread
specific data to get the thread progress data pointer.
With this refactor the tpd is passed to each of the functions
which greatly decreases the number of ethr_get_tsd calls
which in turn halves the CPU usage of the poller thread in
certain scenarios.
|
|
When a module has been purged from memory, any literals belonging
to that module will be copied to all processes that hold references
to them.
The max heap size limit would be ignored in the garbage collection
initiated when copying literals to a process. If the max heap size
was exceeded, the process would typically be terminated in the
following garbage collection.
Since the process would be killed anyway later, kill the process
before copying a literal that would make it exceed its max heap
size.
While at it, also fix a potential bug in `erlang:garbage_collect/0`.
If it was found that the max heap sized had been exceeded while
executing `erlang:garbage_collect/0`, the process would enter a
kind of zombie state instead of being properly terminated.
|
|
causing ASSERT in sys_memset to fail.
|
|
* sverker/erts/ets-select_replace-bug/OTP-15346:
erts: Fix bug in ets:select_replace for bound key
|
|
which may cause following calls to ets:next or ets:prev to fail.
|
|
|
|
* sverker/erts/robustify-dist-entry-states/OTP-15297:
erts: Refactor port dist_entry & conn_id into PRTSD
Remove ugly fail case macros
Consolidate distribution entry state transitions
erts: Fix bug in undocumented system_flag(scheduling_statistics)
|
|
|
|
spelled out as "port specific data".
|
|
|
|
* Make connection_id part of the distribution handle as {ConnId, DistEntry}
in order for BIFs to verify correct connection.
* Make distribution handle opaque to net_kernel.
* Remove some unsafe lockless reads of DistEntry.flags
* Change state ERTS_DE_STATE_EXITING to be more of an internal state that
prevents erts from enqueue, encode or schedule new data to be sent. Otherwise
it should behave like ERTS_DE_STATE_CONNECTED.
|
|
* john/erts/improve-list-reverse-trapping/OTP-15199:
Improve trapping in lists:reverse/2
Fix unsafe use of lists:reverse/1
|