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.

  • Add an update with your previous OS version. Start through the Kernel Newbies site, which has great high level bullets of each Kernel version change. Start looking through each version between your old version + new version. You may find something. This might also relate to libc or libpthreads updates. – David Favor Oct 28 '17 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.