From patchwork Tue Jul 3 02:17:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Figg X-Patchwork-Id: 168673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 9B6D72C00BA for ; Tue, 3 Jul 2012 12:18:09 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Slsgi-0005yD-9z; Tue, 03 Jul 2012 02:18:00 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Slsgf-0005wm-Jw for kernel-team@lists.ubuntu.com; Tue, 03 Jul 2012 02:17:57 +0000 Received: from static-50-53-107-235.bvtn.or.frontiernet.net ([50.53.107.235] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Slsgf-0001Jm-8C for kernel-team@lists.ubuntu.com; Tue, 03 Jul 2012 02:17:57 +0000 From: Brad Figg To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2] [NATTY] (pre-upstream) Fix leapsecond triggered hrtimer/futex load spike issue Date: Mon, 2 Jul 2012 19:17:52 -0700 Message-Id: <1341281876-28601-5-git-send-email-brad.figg@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1341281876-28601-1-git-send-email-brad.figg@canonical.com> References: <1341281876-28601-1-git-send-email-brad.figg@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: John Stultz BugLink: http://bugs.launchpad.net/bugs/1020285 Backport for 2.6.32.59 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`" Credit: http://www.sheeri.com/content/mysql-and-leap-second-high-cpu-and-fix 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: stable@vger.kernel.org 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 d27c756..8486e775 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, timekeeper.mult); + clock_was_set(); } /**