On Thu, 14 Dec 2017, Mathieu Desnoyers wrote: > If we port this concept to kernel-space (as I start to understand > would be your wish), then a simple pointer store to the current > task_struct would suffice.
Certainly such a port would be beneficial for non x86 archs. But my company has extensive user space code that maintains a lot of counters and does other tricks to get full performance out of the hardware. Such a mechanism would also be good from user space. Why keep the good stuff only inside the kernel?

