Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Fix unused variable | Kazuhiro NISHIYAMA | 2019-07-29 | 1 | -3/+3 |
| | |||||
* | Use PRIuSIZE instead of "%zu" | Nobuyoshi Nakada | 2019-07-25 | 1 | -7/+10 |
| | |||||
* | Add documentation to `fiber_pool_allocate_memory`. | Samuel Williams | 2019-07-19 | 1 | -0/+7 |
| | |||||
* | Fix 32-bit build and typo. | Samuel Williams | 2019-07-19 | 1 | -2/+2 |
| | | | | | "Therefore, `fiber_pool_stack_free(&vacancy->stack)` can do the wrong thing..." should be "... `fiber_pool_stack_free(stack)` ...". | ||||
* | Ensure that madvise does not clobber vacancy data. | Samuel Williams | 2019-07-19 | 1 | -5/+19 |
| | | | | | | | | | After calling `fiber_pool_vacancy_reset`, `vacancy->stack` and `stack` are no longer in sync. Therefore, `fiber_pool_stack_free(&vacancy->stack)` can do the wrong thing and clobber the vacancy data. Additionally, when testing using VM_CHECK_MODE > 0, use MADV_DONTNEED if possible, to catch issues w.r.t. clobbered vacancy data earlier. | ||||
* | Better usage of `rb_ec_clear_vm_stack` to maintain invariants. | Samuel Williams | 2019-07-19 | 1 | -6/+7 |
| | |||||
* | Improve ec assertions. | Samuel Williams | 2019-07-19 | 1 | -8/+0 |
| | |||||
* | initialize only Fiber's cfp. | Koichi Sasada | 2019-07-19 | 1 | -0/+1 |
| | | | | | | | fiber->cont.saved_ec.cfp should be initialized by NULL because no vm_stack is allocated. However, cont_init() captures current Fiber's cfp for continuation, so it should only initialize fibers. | ||||
* | Revert "Ensure cfp is initialized to NULL." | Samuel Williams | 2019-07-19 | 1 | -6/+0 |
| | | | | This reverts commit d7fdf45a4ae1bcb6fac30a24b025d4f20149ba0a. | ||||
* | Ensure cfp is initialized to NULL. | Samuel Williams | 2019-07-19 | 1 | -0/+6 |
| | | | | | | | `cont_init` didn't initialize `cont->saved_ec.cfp`. Calling `cont_mark` would result in an invalid `cfp` in `rb_execution_context_mark`. Because fibers lazy-initialize the stack, fibers that are created but not resumed could cause this problem to occur. | ||||
* | Remove `rb_vm_push_frame` as it is no longer used. | Samuel Williams | 2019-07-19 | 1 | -12/+0 |
| | |||||
* | Adjust styles and indents | Nobuyoshi Nakada | 2019-07-19 | 1 | -21/+33 |
| | |||||
* | check saved_ec.cfp | Koichi Sasada | 2019-07-18 | 1 | -1/+3 |
| | |||||
* | Ensure we don't have dangling cfp. | Samuel Williams | 2019-07-19 | 1 | -0/+1 |
| | |||||
* | * remove trailing spaces. | git | 2019-07-18 | 1 | -1/+1 |
| | |||||
* | Improve `fiber_pool_expand` allocation strategy. | Samuel Williams | 2019-07-18 | 1 | -23/+47 |
| | | | | | | | | If `mmap` fails to allocate memory, try half the size, and so on. Limit FIBER_POOL_ALLOCATION_MAXIMUM_SIZE to 1024 stacks. In typical configurations this limits the memory mapped region to ~128MB per allocation. | ||||
* | Add experimental `RUBY_SHARED_FIBER_POOL_FREE_STACKS` to control madvise. | Samuel Williams | 2019-07-18 | 1 | -0/+5 |
| | |||||
* | Make fiber_pool more conservative on platforms with limited address space. | Samuel Williams | 2019-07-18 | 1 | -12/+12 |
| | | | | | | | We use COROUTINE_LIMITED_ADDRESS_SPACE to select platforms where address space is 32-bits or less. Fiber pool implementation enables more book keeping, and reduces upper limits, in order to minimise address space utilisation. | ||||
* | Add `struct fiber_pool {int free_stacks;}` to control usage of madvise. | Samuel Williams | 2019-07-18 | 1 | -1/+10 |
| | | | | | | | `madvise(free)` and similar operations are good because they avoid swap usage by clearing the dirty bit on memory pages which are mapped but no longer needed. However, there is some performance penalty if there is no memory pressure. Therefore, we do it by default, but it can be avoided. | ||||
* | Add FIBER_POOL_ALLOCATION_FREE to control allocation/free strategy. | Samuel Williams | 2019-07-18 | 1 | -8/+43 |
| | |||||
* | Limit expansion of fiber pool on 32-bit platforms. | Samuel Williams | 2019-07-18 | 1 | -46/+150 |
| | | | | | | | | | On 32-bit platforms, expanding the fiber pool by a large amount may fail, even if a smaller amount may succeed. We limit the maximum size of a single allocation to maximise the number of fibers that can be allocated. Additionally, we implement the book-keeping required to free allocations when their usage falls to zero. | ||||
* | Enable `madvise` to release stack space back to OS. | Samuel Williams | 2019-07-18 | 1 | -98/+142 |
| | |||||
* | Improve build process and coroutine implementation selection. | Samuel Williams | 2019-07-18 | 1 | -6/+1 |
| | |||||
* | Stack copying implementation of coroutines. | Samuel Williams | 2019-07-18 | 1 | -2/+23 |
| | |||||
* | Implement fiber pool for reduced fiber allocation overhead. | Samuel Williams | 2019-07-18 | 1 | -192/+508 |
| | | | | | | | Replace previous stack cache with fiber pool cache. The fiber pool allocates many stacks in a single memory region. Stack allocation becomes O(log N) and fiber creation is amortized O(1). Around 10x performance improvement was measured in micro-benchmarks. | ||||
* | Make FIBER_USE_NATIVE the default and reformat code. | Samuel Williams | 2019-07-18 | 1 | -518/+252 |
| | |||||
* | * expand tabs. | git | 2019-07-08 | 1 | -35/+35 |
| | |||||
* | Fix indent | Nobuyoshi Nakada | 2019-07-08 | 1 | -4/+4 |
| | |||||
* | Renamed fib to fiber | Nobuyoshi Nakada | 2019-07-08 | 1 | -244/+244 |
| | |||||
* | Use native coroutine implementation on OpenBSD-amd64 | Jeremy Evans | 2019-06-26 | 1 | -1/+0 |
| | | | | When using native fibers, do not load ucontext, as it isn't needed. | ||||
* | Add `ucontext` coroutine implementation for generic fallback. | Samuel Williams | 2019-06-26 | 1 | -4/+4 |
| | |||||
* | * remove trailing spaces. | git | 2019-06-24 | 1 | -1/+1 |
| | |||||
* | Print warning if not using native coroutine. | Samuel Williams | 2019-06-24 | 1 | -0/+2 |
| | |||||
* | Transition root fiber into state FIBER_TERMINATED. | Samuel Williams | 2019-06-20 | 1 | -0/+11 |
| | | | | | | | During fork, it's possible that threads with root fibers are terminated, but fiber state is not updated. `fiber_verify` will subsequently fail. We forcefully enter the FIBER_TERMINATED state when terminating the root fiber. | ||||
* | Ensure that vm_stack is cleared in `thread_cleanup_func_before_exec`. | Samuel Williams | 2019-06-20 | 1 | -9/+2 |
| | | | | | | | | If `vm_stack` is left dangling in a forked process, the gc attempts to scan it, but it is invalid and will cause a segfault. Therefore, we clear it before forking. In order to simplify this, `rb_ec_clear_vm_stack` was introduced. | ||||
* | Revert failed attempt at fixing invalid usage of vm_stack. | Samuel Williams | 2019-06-20 | 1 | -2/+9 |
| | |||||
* | Ensure `vm_stack` is cleared after fork. | Samuel Williams | 2019-06-20 | 1 | -10/+2 |
| | |||||
* | Set `cfp` to null (along with vm_stack) in `rb_fiber_close`. | Samuel Williams | 2019-06-20 | 1 | -0/+1 |
| | |||||
* | Adjust indent | Nobuyoshi Nakada | 2019-06-19 | 1 | -1/+1 |
| | |||||
* | Remove IA64 support. | Samuel Williams | 2019-06-19 | 1 | -92/+1 |
| | |||||
* | Use shared implementation of `rb_ec_initialize_vm_stack`. | Samuel Williams | 2019-06-19 | 1 | -13/+1 |
| | |||||
* | Track how stack was allocated for `cont_free`. | Samuel Williams | 2019-06-19 | 1 | -8/+21 |
| | |||||
* | Better handling of root fiber. | Samuel Williams | 2019-06-19 | 1 | -4/+3 |
| | |||||
* | * expand tabs. | git | 2019-06-12 | 1 | -3/+3 |
| | |||||
* | Add compaction support for more types. | Aaron Patterson | 2019-06-11 | 1 | -5/+37 |
| | | | | | | | | This commit adds compaction support for: * Fibers * Continuations * Autoload Constants | ||||
* | ia64: Don't clear register_stack_start | James Clarke | 2019-04-27 | 1 | -1/+0 |
| | | | | | | | | r59829 stopped clearing stack_start and enabled the code for !FIBER_USE_NATIVE, but we need to do the same for register_stack_start on ia64, otherwise we end up with NULL in cont_save_machine_stack. Closes: https://github.com/ruby/ruby/pull/2155 | ||||
* | [DOC] fix markups [ci skip] | nobu | 2019-03-22 | 1 | -25/+24 |
| | | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e | ||||
* | Fix styles [ci skip] | nobu | 2019-01-09 | 1 | -2/+4 |
| | | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e | ||||
* | Fix #endif annotation. | samuel | 2018-12-28 | 1 | -1/+1 |
| | | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e | ||||
* | Don't allow rb_fiber_resume to raise exception on unborn fiber. | samuel | 2018-12-28 | 1 | -0/+5 |
| | | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e |