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

Minor optimisations to xTaskIncrementTick(). #241

Conversation

RichardBarry
Copy link
Contributor

Description

Create macro versions of uxListRemove() and vListInsertEnd() for use in xTaskIncrementTick(). This provides a minor optimisation to remove the need for a few function calls.

Cycle counts for executing xTaskIncrementTick() on a Cortex-M where the increase in the tick value results in one task being moved from the Blocked list:

Original code: 212
After inlining uxListRemove: 207
After inlining vListInsertEnd: 192

Writing a Cortex-M specific handler in assembly that only calls C code if a task needs to be removed from the blocked list takes the cycle count down to 185. Not sure if saving 7 cycles makes that worthwhile so I've not cleaned it up to check in. However it is probably worth while for the tick interrupts that do not result in a task being removed from the blocked state as the cycle count can be brought below 30 (I think).

Test Steps

Full integration test project running on a Cortex-A9 with GCC and full optimisation. Required a memory barrier, so needs more testing. Suggest running the full tests in QEMU with GCC, IAR and ARM compilers at full optimisation.

…in xTaskIncrementTick(). This provides a minor optimisation to remove the need for a few function calls.
@RichardBarry RichardBarry requested a review from a team as a code owner January 2, 2021 00:14
@alfred2g
Copy link
Contributor

/bot run checks

2 similar comments
@nateglims
Copy link

/bot run checks

@nateglims
Copy link

/bot run checks

@nateglims nateglims closed this Jan 15, 2021
@nateglims nateglims reopened this Jan 15, 2021
@codecov
Copy link

codecov bot commented Apr 19, 2021

Codecov Report

Merging #241 (6cf43c5) into main (71f5af4) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #241   +/-   ##
=======================================
  Coverage   90.60%   90.60%           
=======================================
  Files           3        3           
  Lines         532      532           
  Branches      142      142           
=======================================
  Hits          482      482           
  Misses         14       14           
  Partials       36       36           
Flag Coverage Δ
unittests 90.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71f5af4...6cf43c5. Read the comment docs.

@AniruddhaKanhere AniruddhaKanhere merged commit 6bf3a75 into FreeRTOS:main Apr 19, 2021
@RichardBarry RichardBarry deleted the inline-some-list-functions-to-optimise-xTaskIncrementTick branch June 16, 2021 01:18
laroche pushed a commit to laroche/FreeRTOS-Kernel that referenced this pull request Apr 18, 2024
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.

5 participants