Patchwork [2/2,ONEIRIC] (pre-upstream) Fix leapsecond triggered hrtimer/futex load spike issue

mail settings
Submitter Brad Figg
Date July 3, 2012, 2:17 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/168675/
State New
Headers show


Brad Figg - July 3, 2012, 2:17 a.m.
From: John Stultz <>


Backport for 3.0.36

As widely reported on the internet, some Linux systems after
the leapsecond was inserted are experiencing futex related load
spikes (usually connected to MySQL, Firefox, Thunderbird, Java, etc).

An apparent  workaround for this issue is running:
$ date -s "`date`"


I believe this issue is due to the leapsecond being added without
calling clock_was_set() to notify the hrtimer subsystem of the
change. (Although I've not yet chased all the way down to the
hrtimer code to validate exactly what's going on there).

The workaround functions as it forces a clock_was_set()
call from settimeofday().

This fix adds the required clock_was_set() calls to where
we adjust for leapseconds.

NOTE: This fix *depends* on the previous fix, which allows
clock_was_set to be called from atomic context. Do not try
to apply just this patch.

CC: Prarit Bhargava <>
CC: Thomas Gleixner <>
Reported-by: Jan Engelhardt <>
Signed-off-by: John Stultz <>
Signed-off-by: Brad Figg <>
 kernel/time/timekeeping.c |    1 +
 1 file changed, 1 insertion(+)


diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5f45831..0c433a0 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -176,6 +176,7 @@  void timekeeping_leap_insert(int leapsecond)
 	wall_to_monotonic.tv_sec -= leapsecond;
 	update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
+	clock_was_set();