Skip to content
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

Uorb optimization3 #579

Merged
merged 3 commits into from
Dec 19, 2023
Merged

Uorb optimization3 #579

merged 3 commits into from
Dec 19, 2023

Conversation

jlaitine
Copy link

This changes the way how uORB callbacks are executed;

  • The callback subscriptions are collected in a list withing each process
  • The priority of the processes' callback thread is set to the maximum thread priority within the process
  • All the triggred callbacks are executed in a loop when the callback thread gets to run

Signalling the callback

  • The publisher marks the callback as "triggered" and signals the callback thread. There is no synchronization back from the callback thread potentially allowing the publisher to fire all the registered callbacks/polls at once withouth scheduling away at each signalling semaphore post.

@jlaitine jlaitine requested a review from pussuw December 12, 2023 06:50
@jlaitine jlaitine force-pushed the uorb_optimization3 branch 2 times, most recently from 99a11bb to e09df20 Compare December 12, 2023 14:07
@jlaitine
Copy link
Author

Pushed one more patch to orb_poll, which shaves off 1pp total execution time, from uxrce_dds client.

The callback optimization shave off ~7pp

@jlaitine
Copy link
Author

just re-based to see if also the sitl tests pass now

@jlaitine jlaitine force-pushed the uorb_optimization3 branch 2 times, most recently from e1314e3 to bf99598 Compare December 14, 2023 10:20
@jlaitine jlaitine requested a review from pussuw December 14, 2023 10:21
Copy link

@pussuw pussuw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jlaitine
Copy link
Author

There is something wrong with this; it just doesn't fly properly. Need to investigate more

@jlaitine jlaitine force-pushed the uorb_optimization3 branch 2 times, most recently from cf09b85 to 0a33c79 Compare December 15, 2023 12:49
@jlaitine
Copy link
Author

Did several cleanups, now it is flying good.

The CPU savings are not so big as I hoped, but still around 5pp . But I think that the architecture around callbacks is also cleaner this way, so quite happy with this version.

I removed the orb_poll changes and the dynamic priority changing; they just didn't prove effective.

In protected builds, put all SubscriptionCallbacks into process specific lists, and in the callback
thread execute them in a loop.

Set the priority of the callback threads to the priority of nav_and_controllers+1,
this should be always enough. It is currently very difficult to find the optimal value.

Signed-off-by: Jukka Laitinen <[email protected]>
@jlaitine
Copy link
Author

Added some minor cleanups, tested again on default build, kernel build and sitl

@jlaitine jlaitine merged commit c46237e into main Dec 19, 2023
17 of 18 checks passed
@pussuw pussuw deleted the uorb_optimization3 branch January 24, 2024 10:46
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.

2 participants