It seems like anyone who uses pthread_spin_lock or a similar thing could run into this problem. Whenever one thread waits on another, without telling the kernel, the kernel might make a scheduling decision that ends up being suboptimal (like putting them both on the same core.)
Posted Oct 3, 2012 19:09 UTC (Wed) by martinfick (subscriber, #4455)
[Link]
Agreed. My limited opinion is simply that spinning is a sometimes neccessary evil; avoid it whenever possible; use a kernel supported mechanism if you expect to get consistent kernel behavior.
How 3.6 nearly broke PostgreSQL
Posted Oct 5, 2012 20:45 UTC (Fri) by jhoblitt (subscriber, #77733)
[Link]
Couldn't libpthreads notify the kernel that pthread_spin_lock() is in use? You certainly wouldn't want to introduce a system call on every use but having to branch on the first use by a given pid shouldn't be too expensive.