tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
https://tokio.rs
MIT License
26.76k stars 2.47k forks source link

rt: make the LIFO slot in the multi-threaded scheduler stealable #4941

Open carllerche opened 2 years ago

carllerche commented 2 years ago

The multi-threaded scheduler includes a per-worker LIFO slot used to store the last scheduled task. This can improve certain usage patterns, especially message passing between tasks. However, this LIFO slot is not currently stealable.

As a temporary workaround, #4936 adds an unstable configuration option to disable the LIFO slot.

MortenLohne commented 1 year ago

Is there any further information available on this? I seem to have hit some pathological worst-case behavior with very cpu-heavy tasks, where every thread except one ended up totally stalled. Disabling the LIFO slot resolved the problem, giving me a 20x speedup.

Darksonn commented 1 year ago

It has not been implemented yet.