Skip to content

Commit 6b0586e

Browse files
Nicolas Pitrestephanosio
authored andcommitted
riscv: improve FPU sharing documentation
Augment the doc with functionality added in commit a211970 ("riscv: improve contended FPU switching"). Signed-off-by: Nicolas Pitre <[email protected]>
1 parent ac3dec5 commit 6b0586e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/kernel/services/other/float.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,18 @@ and potentially requesting FPU usage. Because ISR don't have a persistent
206206
register context, there are no provision for saving an ISR's FPU context
207207
either, hence the IRQ disabling.
208208

209+
As an optimization, the FPU context is preemptively restored upon scheduling
210+
back an "active FPU user" thread that had its FPU context saved away due to
211+
FPU usage by another thread. Active FPU users are so designated when they
212+
make the FPU state "dirty" during their most recent scheduling slot before
213+
being scheduled out. So if a thread doesn't modify the FPU state within its
214+
scheduling slot and another thread claims the FPU for itself afterwards then
215+
that first thread will be subjected to the on-demand regime and won't have
216+
its FPU context restored until it attempts to access it again. But if that
217+
thread does modify the FPU before being scheduled out then it is likely to
218+
continue using it when scheduled back in and preemptively restoring its FPU
219+
context saves on the exception trap overhead that would occur otherwise.
220+
209221
Each thread object becomes 136 bytes (single-precision floating point
210222
hardware) or 264 bytes (double-precision floating point hardware) larger
211223
when Shared FP registers mode is enabled.

0 commit comments

Comments
 (0)