Skip to content

sys/xtimer: code simplification (removing long_list, using xtimer_remove, removing redundant expiry check)#13103

Closed
Hyungsin wants to merge 1 commit intoRIOT-OS:masterfrom
Hyungsin:forupstream_xtimer_simplification
Closed

sys/xtimer: code simplification (removing long_list, using xtimer_remove, removing redundant expiry check)#13103
Hyungsin wants to merge 1 commit intoRIOT-OS:masterfrom
Hyungsin:forupstream_xtimer_simplification

Conversation

@Hyungsin
Copy link

@Hyungsin Hyungsin commented Jan 13, 2020

Contributions

@MichelRottleuthner Remove redundant part of xtimer_core.c (e.g., long timer list). I put some comments on the code.

Testing procedure

Issues/PRs references

timer_list_head->start_time = (uint32_t)now;
timer_list_head->long_start_time = (uint32_t)(now >> 32);
}
}
Copy link
Author

@Hyungsin Hyungsin Jan 13, 2020

Choose a reason for hiding this comment

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

_update_timers() already did timer expiry check and it does not have to be re-done here.

timer->offset = 0;
timer->start_time = 0;
timer->long_start_time = 0;
timer->next = NULL;
Copy link
Author

Choose a reason for hiding this comment

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

A few lines above are actually what xtimer_remove() can do.

volatile uint64_t _xtimer_current_time = 0;

static xtimer_t *timer_list_head = NULL;
static xtimer_t *long_list_head = NULL;
Copy link
Author

Choose a reason for hiding this comment

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

does not need to manage a separate long_list. One timer list is actually enough.

@fjmolinas
Copy link
Contributor

@Hyungsin is this only cleanup?

@fjmolinas
Copy link
Contributor

@Hyungsin also in general all this comments you make in the PR are great but it would be even better to have them in the commit message.

@Hyungsin
Copy link
Author

@Hyungsin is this only cleanup?

Yes. I think so.

@Hyungsin Hyungsin force-pushed the forupstream_xtimer_simplification branch from 232b06d to 6ccdedd Compare January 13, 2020 08:41
@Hyungsin Hyungsin changed the title sys/xtimer: code simplification sys/xtimer: code simplification (removing long_list, using xtimer_remove, removing redundant expiry check) Jan 13, 2020
@Hyungsin
Copy link
Author

@Hyungsin also in general all this comments you make in the PR are great but it would be even better to have them in the commit message.

Added details on commit msg.

@smlng smlng added Area: timers Area: timer subsystems Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation labels Jan 15, 2020
@benpicco benpicco requested a review from kaspar030 January 22, 2020 16:16
@stale
Copy link

stale bot commented Jul 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Jul 25, 2020
@stale stale bot closed this Aug 25, 2020
@miri64
Copy link
Member

miri64 commented Aug 25, 2020

Huh? Nobody reviewing this in 7 month? @MichelRottleuthner can you have a look?

@miri64 miri64 reopened this Aug 25, 2020
@stale stale bot closed this Sep 26, 2020
@fjmolinas
Copy link
Contributor

ping @MichelRottleuthner!

@MichelRottleuthner
Copy link
Contributor

The changes make sense but as with all timer related things this needs solid testing to not break something. Sadly I cannot allocate time for this currently.
@pokgak did you consider this for your measurements? Would be interesting to see if/how it affects performance as the measurements indicate there is some headroom that is probably related to this list handling.

@stale stale bot removed the State: stale State: The issue / PR has no activity for >185 days label Sep 28, 2020
@fjmolinas
Copy link
Contributor

The changes make sense but as with all timer related things this needs solid testing to not break something. Sadly I cannot allocate time for this currently.
@pokgak did you consider this for your measurements? Would be interesting to see if/how it affects performance as the measurements indicate there is some headroom that is probably related to this list handling.

If testing is what is missing do you mind adding the other review flags :)

@MichelRottleuthner MichelRottleuthner added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines labels Sep 28, 2020
@pokgak
Copy link
Contributor

pokgak commented Sep 28, 2020

I ran my benchmark on current master (bfb8fc5) and on this PR after a rebase to the same master. The benchmark test is largely based on the tests/bench_timers with some extra measurements added. The code can be found here.

There are some conflict when rebasing, so I just accept all incoming changes. The diff between the rebased PR and master (from the rebased branch git diff master -- sys/xtimer/xtimer_core.c can be found here. Results.

One my test (sleep jitter) timed out on the rebased PR. The test have a periodic timer triggering every 100ms with a number of timer triggering randomly in the background. At 10 background timer, it is still okay but at 20 the tests takes too long (more than 45 seconds) and timed out. I didn't investigate further into as to what causes this.

@miri64
Copy link
Member

miri64 commented Sep 28, 2020

Please also check for the bug fixed in #13850. The test introduced there should cover that, but IMHO it doesn't hurt (except time spent) to also re-test the bug described there under "Issues/PRs references".

@benpicco benpicco requested a review from maribu October 21, 2020 22:35
@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Jun 2, 2021
@stale stale bot closed this Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: timers Area: timer subsystems Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines State: stale State: The issue / PR has no activity for >185 days Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants