12

How does _mm_mwait from pmmintrin.h work? (I mean not the asm for it, but action and how this action is taken in NUMA systems. The store monitoring is easy to implement only on bus-based SMP systems with snooping of bus.)

What processors does implement it?

Is it used in some spinlocks?

Kornel
  • 97,764
  • 37
  • 219
  • 309
osgx
  • 90,338
  • 53
  • 357
  • 513

1 Answers1

3

Every time a CPU on a multicore chip tries to write a specific memory address, all other CPUs, which have this particular memory address in their caches, have to be notified of that change. This notification could be used to implement the wakeup from MWAIT on modern CPUs independent of them having a single or separate memory busses.

What processors does implement it?

MWAIT is part of SSE3.

Is it used in some spinlocks?

This is contrary to the definition of a spinlock - the CPU is not busy.

mschneider
  • 716
  • 4
  • 9
  • I think, the notification is in effect only for data in cache which is in Shared state (when it may be stored in caches of several CPUs). If there is a "all other CPUs have to be notified" for any write, the performance will be bricked (killed); just consider an quad-socket system with NUMA. – osgx Oct 18 '11 at 14:22
  • I think only Intel processors have these two instructions. I recall reading somewhere that AMD decided not to implement them when they added SSE3. – Mysticial Oct 18 '11 at 16:04