diff mbox

[committed] Decrease default spin count in libgomp (PR libgomp/43706)

Message ID 20101202144305.GM29412@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Dec. 2, 2010, 2:43 p.m. UTC
Hi!

As discussed in the PR, the default when OMP_WAIT_POLICY
nor GOMP_SPINCOUNT is not present in the environment, is probably too big
in many cases, when OpenMP programs aren't the sole thing run on the
machine.  Ideally we'd do some dynamic adjustment when we detect that
threads spinning are too often scheduled away from the CPU, but for best
results we'd need some kernel support, or at least query hw profiling
registers.

So, for now, I'm just decreasing the defaults.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2010-12-02  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/43706
	* env.c (initialize_env): Default to spin count 300000
	instead of 20000000 if neither OMP_WAIT_POLICY nor GOMP_SPINCOUNT
	is specified.



	Jakub
diff mbox

Patch

--- libgomp/env.c.jj	2010-12-02 09:59:48.000000000 +0100
+++ libgomp/env.c	2010-12-02 10:01:07.000000000 +0100
@@ -502,14 +502,14 @@  initialize_env (void)
     {
       /* Using a rough estimation of 100000 spins per msec,
 	 use 5 min blocking for OMP_WAIT_POLICY=active,
-	 200 msec blocking when OMP_WAIT_POLICY is not specificed
+	 3 msec blocking when OMP_WAIT_POLICY is not specificed
 	 and 0 when OMP_WAIT_POLICY=passive.
 	 Depending on the CPU speed, this can be e.g. 5 times longer
 	 or 5 times shorter.  */
       if (wait_policy > 0)
 	gomp_spin_count_var = 30000000000LL;
       else if (wait_policy < 0)
-	gomp_spin_count_var = 20000000LL;
+	gomp_spin_count_var = 300000LL;
     }
   /* gomp_throttled_spin_count_var is used when there are more libgomp
      managed threads than available CPUs.  Use very short spinning.  */