From patchwork Thu Jul 5 19:12:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 9864 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E963223E4F for ; Thu, 5 Jul 2012 19:13:25 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 99BCFA182BA for ; Thu, 5 Jul 2012 19:13:25 +0000 (UTC) Received: by yhpp61 with SMTP id p61so9295205yhp.11 for ; Thu, 05 Jul 2012 12:13:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=EIF5nO7nD3tfgcp8Og0Xi67j4bfEC8UCIHGT4n+KXMY=; b=DzXzWIQbYbVBjwOf5Y9OJCxZYmTRxwmRuvdW9uFPlrSC4su2f5n2hrnbWYEjP3jP7H Tn/2GOix38j75SB9muTaatul/HM68nw+YGC5nulSrLo3eNyaDLgdlL62OOt3pA0Pu9xU 9NP7yuygyh9dyIA6DLIUQYEKb868jsLlJXuL15zMcSDHWqEqVaq9YfSv17XF9+cgt++D DkdrXR0KHcbCYsZqAoAdAYp8M1FashvaowfpCp7Ti9KjKsyL6mGmUF68ZSr7otyBV3nd 9QKZJrTzbxhmAKsckOWsObVE9PQHfR1cs+pPysB/4yp8VNhgc7PfSOZpSJMxkgbmUu48 W6nQ== Received: by 10.50.163.99 with SMTP id yh3mr603557igb.53.1341515604494; Thu, 05 Jul 2012 12:13:24 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp204ibb; Thu, 5 Jul 2012 12:13:23 -0700 (PDT) Received: by 10.50.163.5 with SMTP id ye5mr659933igb.37.1341515603585; Thu, 05 Jul 2012 12:13:23 -0700 (PDT) Received: from e9.ny.us.ibm.com (e9.ny.us.ibm.com. [32.97.182.139]) by mx.google.com with ESMTPS id vb2si1277170igc.71.2012.07.05.12.13.23 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 12:13:23 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.139 as permitted sender) client-ip=32.97.182.139; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.182.139 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Jul 2012 15:13:23 -0400 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 5 Jul 2012 15:13:21 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id A878A6E8054 for ; Thu, 5 Jul 2012 15:13:20 -0400 (EDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q65JDGqp230898 for ; Thu, 5 Jul 2012 15:13:16 -0400 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q65JDCrc007133 for ; Thu, 5 Jul 2012 13:13:13 -0600 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q65JD4xO006244; Thu, 5 Jul 2012 13:13:10 -0600 From: John Stultz To: Linux Kernel Cc: John Stultz , Prarit Bhargava , stable@vger.kernel.org, Thomas Gleixner Subject: [PATCH 2/3] time: Fix leapsecond triggered hrtimer/futex load spike issue Date: Thu, 5 Jul 2012 15:12:17 -0400 Message-Id: <1341515538-5100-3-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1341515538-5100-1-git-send-email-johnstul@us.ibm.com> References: <1341515538-5100-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12070519-7182-0000-0000-000001ECC13F X-Gm-Message-State: ALoCoQm92WBVjo9j++FISwJhwnXEDDUB4CFOz3G3AfQPXtbJoi3UFefGFpi8o29Azf1ctO+ivpgA 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 for this issue workaround is running: $ date -s "`date`" Credit: http://www.sheeri.com/content/mysql-and-leap-second-high-cpu-and-fix I this issue is due to the leapsecond being added without calling clock_was_set() to notify the hrtimer subsystem of the change. 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 Acked-by: Prarit Bhargava Reported-by: Jan Engelhardt Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 6f46a00..cc2991d 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -963,6 +963,8 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) leap = second_overflow(timekeeper.xtime.tv_sec); timekeeper.xtime.tv_sec += leap; timekeeper.wall_to_monotonic.tv_sec -= leap; + if (leap) + clock_was_set(); } /* Accumulate raw time */ @@ -1079,6 +1081,8 @@ static void update_wall_time(void) leap = second_overflow(timekeeper.xtime.tv_sec); timekeeper.xtime.tv_sec += leap; timekeeper.wall_to_monotonic.tv_sec -= leap; + if (leap) + clock_was_set(); } timekeeping_update(false);