-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Reworked missed work avoidance mechanism #417
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
Reworked missed work avoidance mechanism #417
Conversation
|
@aleksei-fedotov @anton-potapov @alexey-katranov, could you please review this patch? |
Yep. Working on it! |
| //! Index of the element following the last ready task in the deque. | ||
| /** Modified by the owner thread. **/ | ||
| std::atomic<std::size_t> tail; | ||
| std::atomic<std::size_t> shadow_tail; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment what shadow_tail is for and how different it is from the tail.
| //! Index of the first ready task in the deque. | ||
| /** Modified by thieves, and by the owner during compaction/reallocation **/ | ||
| std::atomic<std::size_t> head; | ||
| std::atomic<std::size_t> shadow_head; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment what shadow_head is for and how different it is from the head.
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pkumbras <[email protected]>
e3f2165 to
40b4e23
Compare
|
Rebased on top of the current code base. However, I think the patch needs to be revisited first. Two tests failing on ARM likely mean that "shadowing" the head and the tail may require some extra synchronization.
Update: apparently, the patch does not even achieve its goal, because |
|
Reimplemented in a different way in #1779; closing this PR. |
When threads execute
get_taskorsteal_taskthey can omit unsuitable tasks (different isolation or affinity). The omitted tasks are virtually extracted from task pool, that makes them temporary invisible for other threads. It might lead to situation when another thread marks the arenaEMPTY(as a result ofis_out_of_work()), while these tasks are still in the arena. If tasks were omitted we need to notify the arena like new work was added (callingadvertise_new_work()).The proposed idea is that omit tasks in such way that other threads can not observe it. It will prevent unnecessary arena state transition and premature threads leaving.
Therefore, the patch introduce shadow tail and head which move after real task extracted(do not participate in tasks omitting mechanism).
Signed-off-by: pavelkumbrasev [email protected]