sys/pm_layered: move (un)block assert for minor speedup #18842
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@jue89 is doing good work adding pm_layerd where its needed, this PR shall optimize pm_block and unblock
Contribution description
this moves the assert into the irq guard guard which will spare us the extra load that is need for it (irq disable invalidate memory to ensure there is not reordering)
Testing procedure
read
compile
do speed tests
read assembly
I do not have a slow arm at hand -> i read the assembly for
old:
this PR:
atomic:
the atomic has no assert i just wanted to see what the ++ would look like without irq disable.
dmb ish
is a memory barrierthis pr but using uint_fast8_t:
from what I read about arm memory access times the last variant may be faster (even though it is longer) since the
ldr.w
is aligned for all modes whileldrb
might be slower if not aligned (mode 1,2,3). but in both cases the assert should be moved to reduce the number ofldr
.Issues/PRs references
#18821
#17607