altos: Don't wait while idle if trying to minimize interrupt latency
authorKeith Packard <keithp@keithp.com>
Mon, 21 Nov 2016 04:56:01 +0000 (20:56 -0800)
committerKeith Packard <keithp@keithp.com>
Mon, 20 Feb 2017 19:22:21 +0000 (11:22 -0800)
Keeping the scanout running reasonably means keeping interrupt latency
constant, and that requires leaving the CPU running. Don't wait for
interrupts when the system is running in this mode.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/kernel/ao_task.c

index e8a092aaf660fcf6bbec48706e14d2f7936e297b..de23ea02421013e4186801b85664abb81630d99a 100644 (file)
@@ -373,7 +373,11 @@ ao_yield(void) ao_arch_naked_define
                if (!ao_list_is_empty(&run_queue))
                        break;
                /* Wait for interrupts when there's nothing ready */
-               ao_arch_wait_interrupt();
+               if (ao_task_minimize_latency) {
+                       ao_arch_release_interrupts();
+                       ao_arch_block_interrupts();
+               } else
+                       ao_arch_wait_interrupt();
        }
        ao_cur_task = ao_list_first_entry(&run_queue, struct ao_task, queue);
 #else