Skip to content

[WIP] Add support for recursive locks and try_lock #111

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

Closed
wants to merge 3 commits into from

Conversation

janciesko
Copy link
Collaborator

@janciesko janciesko commented Sep 8, 2022

This implements a recursive lock using FEBs. The idea is that qthreade_read_FE becomes re-entrant if qthread_read_FE is called from qthread_lock and qthread_lock_init has been called on the same address setting is_recursive to true. Analogously, qthread_unlock calls qthead_fill which decrements a counter of a recursive lock. If the counter reaches zero, blocked waiters (EFQ) are unblocked.

Uses of other FEB calls over recursive locks are unsupported and we could error out. Currently they have no effect but could lead to programming errors if programmer expects FEB synchronization over an address used for a recursive lock.

Todo

  • Add unit test
  • Error out in incorrect use
  • Update qthread_feb_blocker_func to use proper func name

With this infrastructure, we should be able to support ULTs from Open MPI.
For Open MPI, we'd need then these changes:
janciesko/ompi@daef600
janciesko/ompi@bab853b

@janciesko
Copy link
Collaborator Author

janciesko commented Sep 14, 2022

This implementation is not going to fly. The problem is that unlike locks in ptheads, FEBs do not poll a state but generate the dependency graph at instantiation and thus cannot ignore conditions based on ownership (runtime property). At runtime, we'd need to modify the graph in order to ignore prod-cons but the notion of recursiveness is lost and we cannot associate inner producers to inner consumers.

@janciesko
Copy link
Collaborator Author

Closing in favor of #112

@janciesko janciesko closed this Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant