sysconf(_SC_NPROCESSORS_ONLN) is expensive in RHEL6
Issue
Qtapplication that has a lot of threads and usesQReadWriteLocksto protect data that the threads are accessing. When the server is heavily loaded, the application spends about 60% of it's time in system time as opposed to user time. Further investigation showed that theQMutexclass is callingsysconf(_SC_NPROCESSORS_ONLN)for each thread that tries to get a lock where that lock is already locked.
Environment
- Red Hat Enterprise Linux (RHEL) 6.4
- qt
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.