This uses a couple of techniques common in Linux audio real-time programming: if possible, run the latency-sensitive capture thread with the SCHED_RR scheduling policy so it will preempt other userspace processes, and use mlock to ensure that the disk buffers stay in main memory rather than being paged out.
I tested this on my oldest USB3-capable machine (a Lenovo X220), and it significantly reduces the incidence of test-mode errors when the machine's under deliberately heavy load. On a current machine running a PREEMPT-RT kernel, I ran an 8h test-mode capture without errors while doing large compiles in the background.
This only affects the USB capture side of things - it would be worth thinking about increasing the number of disk buffers as well by default, since the current buffer is only about 3 seconds' worth of capture, and I expect most machines with USB3 can spare a couple of gigs of memory...
This uses a couple of techniques common in Linux audio real-time programming: if possible, run the latency-sensitive capture thread with the
SCHED_RR
scheduling policy so it will preempt other userspace processes, and usemlock
to ensure that the disk buffers stay in main memory rather than being paged out.I tested this on my oldest USB3-capable machine (a Lenovo X220), and it significantly reduces the incidence of test-mode errors when the machine's under deliberately heavy load. On a current machine running a PREEMPT-RT kernel, I ran an 8h test-mode capture without errors while doing large compiles in the background.
This only affects the USB capture side of things - it would be worth thinking about increasing the number of disk buffers as well by default, since the current buffer is only about 3 seconds' worth of capture, and I expect most machines with USB3 can spare a couple of gigs of memory...