Linux kernel: the cost of immediate removal

From http://lkml.indiana.edu/hypermail/linux/kernel/0103.1/0030.html I will learn about the new type of mutexes in linux, adaptive_np one:

PTHRED_MUTEX_ADAPTIVE_NP - A new mutex designed for high throughput with sacrifice of justice and even processor cycles. This mutex does not transfer ownership of the expectation of a stream, but allows competition. In addition, over the SMP core, the locking operation uses a rotation, try locking again to avoid immediate data collection.

It refers to the "Cost of immediate removal." How much is it? (In terms of cpu ticks, TLB, TSS, smth else reloading) What is done in the kernel between the "immediate delete request" and reconfiguration to the start state?

How can I perform an explicit deletion and how can I measure its value?

+4
source share
1 answer

This seems to be just a lightweight lock, designed to allow threads to escape the scheduler.

The idea is to replace a relatively heavy context-based operation with a promising time period spent in a spin lock.

Ignore the use of "new", spin-locks as old as the hills. It was, I think, new to this pthread library almost 10 years ago.

"Explicit data deletion" seems to be the same as the context switch, so you can measure this by pointing two CPU yield() threads to each other a million times and measuring the runtime.

+3
source

Source: https://habr.com/ru/post/1301352/


All Articles