I have a multi-threaded app, with 4 worker threads that until recently performed very well on my 4-core CPU.
The system is running Ubuntu 16.04.3 LTS.
Today I updated my OS with sudo apt-get dist-upgrade
Now, I suddenly see much lower performance in my app, and I have traced it down to the worker threads getting context-switched involuntarily.
Looking at /proc/xxx/status for a worker thread, I see that it is getting hit with 80 involuntary context switches per second or so, as the nonvoluntary_ctxt_switches field is increasing quickly.
Note that at least 30 times per second, there will be no work in the queue, and the workerthreads will voluntary go to sleep.
Thread NICE value is 0, and PRIORITY is 20.
Why did those involuntary context switches suddenly pop up? Did Ubuntu recently change the scheduler in the kernel or something? Are there any ways to find out why and who is bumping the threads?
Also: not only do the treads get switched out, it takes quite a bit of time to get serviced again.