Skip to content

Conversation

@Gelbpunkt
Copy link
Member

@Gelbpunkt Gelbpunkt commented Nov 27, 2025

This refactors our timer interrupt handling into a separate module that all timer interrupts are configured through and handled by. It allows us to track why a timer interrupt was fired.

We make use of this to now only conditionally wake the network task's waker when necessary. This is either because we sent some network packets, a network device driver received an interrupt, or because a timer interrupt that we configured so we can poll smoltcp in the future was handled.

Closes #2126.

@mkroening mkroening self-assigned this Nov 27, 2025
@Gelbpunkt Gelbpunkt force-pushed the wakers branch 2 times, most recently from 9c652d1 to c03dc8e Compare November 27, 2025 11:27
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Benchmark Results

Details
Benchmark Current: 7a4cd75 Previous: e645fec Performance Ratio
startup_benchmark Build Time 100.16 s 99.81 s 1.00
startup_benchmark File Size 0.87 MB 0.86 MB 1.01
Startup Time - 1 core 0.93 s (±0.04 s) 0.93 s (±0.04 s) 0.99
Startup Time - 2 cores 0.94 s (±0.05 s) 0.96 s (±0.03 s) 0.98
Startup Time - 4 cores 0.93 s (±0.03 s) 0.94 s (±0.03 s) 0.99
multithreaded_benchmark Build Time 101.65 s 102.13 s 1.00
multithreaded_benchmark File Size 0.97 MB 0.97 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 89.13 % (±9.40 %) 88.34 % (±8.04 %) 1.01
Multithreaded Pi Efficiency - 4 Threads 43.34 % (±3.79 %) 44.56 % (±3.57 %) 0.97
Multithreaded Pi Efficiency - 8 Threads 25.08 % (±1.89 %) 25.91 % (±1.86 %) 0.97
micro_benchmarks Build Time 104.32 s 100.32 s 1.04
micro_benchmarks File Size 0.97 MB 0.97 MB 1.00
Scheduling time - 1 thread 68.99 ticks (±4.37 ticks) 68.60 ticks (±3.48 ticks) 1.01
Scheduling time - 2 threads 39.57 ticks (±5.51 ticks) 40.01 ticks (±5.48 ticks) 0.99
Micro - Time for syscall (getpid) 4.02 ticks (±0.54 ticks) 3.30 ticks (±0.47 ticks) 1.22
Memcpy speed - (built_in) block size 4096 64052.43 MByte/s (±45393.26 MByte/s) 66423.24 MByte/s (±47211.72 MByte/s) 0.96
Memcpy speed - (built_in) block size 1048576 29611.83 MByte/s (±24277.61 MByte/s) 29366.89 MByte/s (±24195.28 MByte/s) 1.01
Memcpy speed - (built_in) block size 16777216 25591.21 MByte/s (±21445.88 MByte/s) 24865.20 MByte/s (±20794.46 MByte/s) 1.03
Memset speed - (built_in) block size 4096 64881.68 MByte/s (±45983.33 MByte/s) 66997.01 MByte/s (±47611.29 MByte/s) 0.97
Memset speed - (built_in) block size 1048576 30365.20 MByte/s (±24710.05 MByte/s) 30137.28 MByte/s (±24628.24 MByte/s) 1.01
Memset speed - (built_in) block size 16777216 26345.61 MByte/s (±21915.59 MByte/s) 25636.38 MByte/s (±21296.15 MByte/s) 1.03
Memcpy speed - (rust) block size 4096 61323.25 MByte/s (±45247.39 MByte/s) 60802.24 MByte/s (±44540.11 MByte/s) 1.01
Memcpy speed - (rust) block size 1048576 29509.17 MByte/s (±24249.73 MByte/s) 29548.98 MByte/s (±24182.47 MByte/s) 1.00
Memcpy speed - (rust) block size 16777216 24764.69 MByte/s (±20860.48 MByte/s) 25616.27 MByte/s (±21548.07 MByte/s) 0.97
Memset speed - (rust) block size 4096 62007.22 MByte/s (±45683.42 MByte/s) 61752.87 MByte/s (±45214.15 MByte/s) 1.00
Memset speed - (rust) block size 1048576 30214.18 MByte/s (±24655.61 MByte/s) 30310.81 MByte/s (±24622.20 MByte/s) 1.00
Memset speed - (rust) block size 16777216 25523.71 MByte/s (±21348.85 MByte/s) 26370.24 MByte/s (±22014.77 MByte/s) 0.97
alloc_benchmarks Build Time 94.93 s 94.69 s 1.00
alloc_benchmarks File Size 0.94 MB 0.93 MB 1.01
Allocations - Allocation success 100.00 % 100.00 % 1
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 100.00 % 100.00 % 1
Allocations - Average Allocation time 8696.55 Ticks (±228.59 Ticks) 9799.65 Ticks (±144.68 Ticks) 0.89
Allocations - Average Allocation time (no fail) 8696.55 Ticks (±228.59 Ticks) 9799.65 Ticks (±144.68 Ticks) 0.89
Allocations - Average Deallocation time 1249.65 Ticks (±727.81 Ticks) 919.79 Ticks (±324.70 Ticks) 1.36
mutex_benchmark Build Time 93.15 s 93.42 s 1.00
mutex_benchmark File Size 0.97 MB 0.97 MB 1.00
Mutex Stress Test Average Time per Iteration - 1 Threads 12.62 ns (±0.56 ns) 12.86 ns (±0.77 ns) 0.98
Mutex Stress Test Average Time per Iteration - 2 Threads 92.90 ns (±4.65 ns) 13.22 ns (±0.90 ns) 7.03

This comment was automatically generated by workflow using github-action-benchmark.

@Gelbpunkt Gelbpunkt force-pushed the wakers branch 8 times, most recently from 390c379 to 466882e Compare December 22, 2025 09:45
@mkroening mkroening self-requested a review December 22, 2025 10:12
@Gelbpunkt Gelbpunkt marked this pull request as ready for review December 22, 2025 10:13
@Gelbpunkt Gelbpunkt force-pushed the wakers branch 3 times, most recently from f48f443 to 839554d Compare January 8, 2026 10:51
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Thanks a lot; this is looking great! :)

Comment on lines +586 to +584
create_timer_abs(Source::Scheduler, wt);
return;
}

cursor.move_next();
}

set_oneshot_timer();
create_timer_abs(Source::Scheduler, wt);
Copy link
Member

Choose a reason for hiding this comment

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

The docs say that wakeup_time is relative. This was also done wrongly before, but maybe we should follow up to fix this.

@Gelbpunkt Gelbpunkt force-pushed the wakers branch 2 times, most recently from e1f9653 to d5f9bef Compare January 22, 2026 15:26
This refactors our timer interrupt handling into a separate module that
all timer interrupts are configured through and handled by. It allows us
to track why a timer interrupt was fired.

We make use of this to now only conditionally wake the network task's
waker when necessary. This is either because we sent some network
packets, a network device driver received an interrupt, or because a
timer interrupt that we configured so we can poll smoltcp in the future
was handled.
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.

Task wakeup timer is overwritten

2 participants