[LAD] Kontakt Spikes

Michael Ost most at museresearch.com
Tue Oct 25 00:28:19 UTC 2011


On 10/11/2011 03:10 PM, Paul Davis wrote:
> On Tue, Oct 11, 2011 at 5:33 PM, Michael Ost<most at museresearch.com>  wrote:
>
>> We have gotten some interesting results from cyclictest and the new ftrace
>> system. Hopefully that will point us to some kernel latency that we can work
>> around or fix.
>
> it would be really great if you could share at least what you find out
> about the problems, even if you don't want to share the fixes.

As promised, here's what I found.

Our Wine provides the following required tweaks:

* Kontakt needs to be able to get and set realtime thread priority with 
Get/SetThreadPriority(THREAD_PRIORITY_TIME_CRITICAL)

* Kontakt needs to be able to call Get/SetThreadPriority() without a 
trip to the wine server.

* Kontakt's helper threads need to be prevented from running while audio 
processing is underway unless there is a core available for them to 
process on. For our host, we solved this by running them with 
SCHED_FIFO/P-1, where our audio processing threads are running at 
SCHED_RR/P. So, if our host is using core1, their threads can run on 
core2. But if our host is using both core1 and core2 for audio 
processing, they won't wake up until processing is over.

The other crucial piece appears to be improvements to the kernel between 
2.6.24 and 2.6.33. We found that even with the thread priorities fixed, 
we could mess up kontakt's performance by dropping disk caches (echo 2 > 
/proc/sys/vm/drop_caches). That got fixed in 2.6.33, presumably by 
improvements in preemtibility.

That was three week's of work! But I'm glad to have got to the bottom of 
it. And thanks to the list for helping point me in the right direction.

- Michael Ost



More information about the Linux-audio-dev mailing list