minor tweak to MicroLock slow path
authorNathan Bronson <ngbronson@fb.com>
Mon, 7 Mar 2016 21:36:59 +0000 (13:36 -0800)
committerFacebook Github Bot 4 <facebook-github-bot-4-bot@fb.com>
Mon, 7 Mar 2016 21:50:22 +0000 (13:50 -0800)
commite756d07cd35714d7528444321ea5145b41f5ae0f
tree38ff1a5a2c9d191638c28834ea002314af9a84c1
parent07dc3ce5923b2d761ca9fd7cd53ee890a4ad839d
minor tweak to MicroLock slow path

Summary:This diff uses the x86 "pause" instruction or its equivalent when
spinning in the MicroLock slow loop.  This gives a hint to the processor
that it should devote more resources to the other execution contexts
sharing the same core.  This diff also removes an mfence on x86 by using
a slightly stronger memory model on the preceding compare_exchange_weak,
and switches to a more portable way of invoking sched_yield().

Reviewed By: dcolascione

Differential Revision: D3018568

fb-gh-sync-id: 02e0ab3a9d9bb9901eddf54e45b71cbb7758a227
shipit-source-id: 02e0ab3a9d9bb9901eddf54e45b71cbb7758a227
folly/MicroLock.cpp
folly/MicroLock.h