All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Trippelsdorf <markus@trippelsdorf.de>
To: Jan Engelhardt <jengelh@inai.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	simon@fire.lp0.eu
Subject: Re: Leap second insertion causes futex to repeatedly timeout
Date: Sun, 1 Jul 2012 09:02:28 +0200	[thread overview]
Message-ID: <20120701070228.GA246@x4> (raw)
In-Reply-To: <alpine.LNX.2.01.1207010247430.7313@frira.zrqbmnf.qr>

On 2012.07.01 at 02:57 +0200, Jan Engelhardt wrote:
> 
> This year's leap second insertion has had the strange effect on at least 
> Linux versions 3.4.4 (my end) and 3.5-rc4 (Simon's box, Cc) that certain 
> processes use up all CPU power, because of futexes repeatedly timing 
> out. This seems to only affect certain processes.
> 
> Simon observes - http://s85.org/owXfmLvt - that 
> Firefox/Thunderbird/Chrome/Java are affected.

On my ntp synchronized Linux 3.5 testbox I saw a similar issue.

The leap second was successfully inserted last night:
Jul  1 01:59:59 x4 kernel: Clock: inserting leap second 23:59:60 UTC

Because glibc-2.16 was released yesterday I've build it this morning.
During "make check" I saw several mutex related tests failures. For
example /nptl/tst-mutex5a.c failed with a "premature timeout difference"
of one second.

tst-mutex5a.c:
#define TYPE PTHREAD_MUTEX_ADAPTIVE_NP
#include "tst-mutex5.c"

from tst-mutex5.c:
// ...
  gettimeofday (&tv, NULL);
  TIMEVAL_TO_TIMESPEC (&tv, &ts);

  ts.tv_sec += 2;	/* Wait 2 seconds.  */

  err = pthread_mutex_timedlock (&m, &ts);
// ...
    {
      int clk_tck = sysconf (_SC_CLK_TCK);

      gettimeofday (&tv2, NULL);

      tv2.tv_sec -= tv.tv_sec;
      tv2.tv_usec -= tv.tv_usec;
      if (tv2.tv_usec < 0)
	{
	  tv2.tv_usec += 1000000;
	  tv2.tv_sec -= 1;
	}

      /* Be a bit tolerant, add one CLK_TCK.  */
      tv2.tv_usec += 1000000 / clk_tck;
      if (tv2.tv_usec >= 1000000)
	{
	  tv2.tv_usec -= 1000000;
	  ++tv2.tv_sec;
	}

      if (tv2.tv_sec < 2)
	{
	  printf ("premature timeout: %ld.%06ld difference\n",
		  tv2.tv_sec, tv2.tv_usec);
	  return 1;
	}
    }
// ...

-- 
Markus

  reply	other threads:[~2012-07-01  7:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-01  0:57 Leap second insertion causes futex to repeatedly timeout Jan Engelhardt
2012-07-01  7:02 ` Markus Trippelsdorf [this message]
2012-07-01  8:16 ` john stultz
2012-07-01  8:36   ` Ben Blum
2012-07-01  9:07     ` John Stultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120701070228.GA246@x4 \
    --to=markus@trippelsdorf.de \
    --cc=jengelh@inai.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=simon@fire.lp0.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.