summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/z_Linux_util.cpp
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2017-02-15 17:19:21 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2017-02-15 17:19:21 +0000
commit581fdbaad4e0becaf738ca34d9bf907e86248408 (patch)
tree0a212b9b697e65d8b9de9da727d52b21008c122d /openmp/runtime/src/z_Linux_util.cpp
parentce47cf35322345ddf23b08197cc9fbb3b7bccb0d (diff)
downloadbcm5719-llvm-581fdbaad4e0becaf738ca34d9bf907e86248408.tar.gz
bcm5719-llvm-581fdbaad4e0becaf738ca34d9bf907e86248408.zip
Enable yield cycle on Linux
This change allows the runtime to turn __kmp_yield() on/off repeatedly on Linux. This feature was removed when disabling monitor thread, but there are applications that perform better with this feature on. Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D29227 llvm-svn: 295203
Diffstat (limited to 'openmp/runtime/src/z_Linux_util.cpp')
-rw-r--r--openmp/runtime/src/z_Linux_util.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp
index b9490ea65d3..8cba1ff5607 100644
--- a/openmp/runtime/src/z_Linux_util.cpp
+++ b/openmp/runtime/src/z_Linux_util.cpp
@@ -1812,13 +1812,16 @@ __kmp_resume_monitor()
void
__kmp_yield( int cond )
{
- if (cond
+ if (!cond)
+ return;
#if KMP_USE_MONITOR
- && __kmp_yielding_on
+ if (!__kmp_yielding_on)
+ return;
+#else
+ if (__kmp_yield_cycle && !KMP_YIELD_NOW())
+ return;
#endif
- ) {
- sched_yield();
- }
+ sched_yield();
}
/* ------------------------------------------------------------------------ */
OpenPOWER on IntegriCloud