Skip to content

Fixup MN threads support #9301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 19, 2023
Merged

Fixup MN threads support #9301

merged 3 commits into from
Dec 19, 2023

Conversation

ko1
Copy link
Contributor

@ko1 ko1 commented Dec 19, 2023

This PR contains 2 patches.

  1. use waiting_fd for thread_sched_wait_events() to support wakeup by closing the fd by other threads.
  2. use rb_thread_io_blocking_call() more to utilize MN threads.

ko1 added 3 commits December 20, 2023 06:27
`thread_sched_wait_events()` suspend the thread until the target
fd is ready. Howver, other threads can close the target fd and
suspended thread should be awake. To support it, setup `waiting_fd`
before `thread_sched_wait_events()`.

`rb_thread_io_wake_pending_closer()` should be called before
`RUBY_VM_CHECK_INTS_BLOCKING()` because it can return this function.

This patch introduces additional overhead (setup/cleanup `waiting_fd`)
and maybe we can reduce the overhead.
use `rb_thread_io_blocking_call()` instead of
`rb_thread_io_blocking_region()` more.

See ruby#9178 (comment)
@ko1 ko1 enabled auto-merge (rebase) December 19, 2023 21:48
@ko1 ko1 merged commit 7a0dfde into ruby:master Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant