From patchwork Wed Jul 4 06:21:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john stultz X-Patchwork-Id: 9811 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 1298B23E23 for ; Wed, 4 Jul 2012 06:22:02 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id B7F8FA187E3 for ; Wed, 4 Jul 2012 06:22:01 +0000 (UTC) Received: by ghbz12 with SMTP id z12so6657477ghb.11 for ; Tue, 03 Jul 2012 23:22:01 -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=qxBf7MLrSiclVK3WopLPEwtrFGIO/z8e5Fx/W5u7YTU=; b=SGKp/Ac6XibNIsNconbDTECCrOzNzOfLbAoWDd1SW4BdomAzDyEATlq3kLvGstD9WE qSt4Cuvh3MPxPD14ABObRoZBDv7+84xyDAoklfFcf4sUjb5yO8Gg0Po6ALwruMin2O0V lOTMgLUeqVEWQEud57uxCzgmGPFjKmypYhO+9M2pz0J6qiSh/49xIF/4vxL4ncwWrwo8 lzw2xO8a6VskXuV6wtQqM6I7iTEvU+twUjminoEQh5VNdkeGO/Yx9z2v5v+3kjl4GTsk HQd0oEC9Z4iXkUSmFeGLZh7doZBfqPwldaBiEVi9IFPewEEVXTsWk3BQmpHmqbmkZ5Po N/Qw== Received: by 10.50.163.99 with SMTP id yh3mr10406453igb.53.1341382920943; Tue, 03 Jul 2012 23:22:00 -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 v20csp49790ibb; Tue, 3 Jul 2012 23:21:59 -0700 (PDT) Received: by 10.68.241.232 with SMTP id wl8mr14722117pbc.106.1341382919387; Tue, 03 Jul 2012 23:21:59 -0700 (PDT) Received: from e37.co.us.ibm.com (e37.co.us.ibm.com. [32.97.110.158]) by mx.google.com with ESMTPS id pu9si14994430pbc.358.2012.07.03.23.21.58 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 23:21:59 -0700 (PDT) Received-SPF: pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.158 as permitted sender) client-ip=32.97.110.158; Authentication-Results: mx.google.com; spf=pass (google.com: domain of johnstul@us.ibm.com designates 32.97.110.158 as permitted sender) smtp.mail=johnstul@us.ibm.com Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Jul 2012 00:21:58 -0600 Received: from d01dlp03.pok.ibm.com (9.56.224.17) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Jul 2012 00:21:57 -0600 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 003C3C90073 for ; Wed, 4 Jul 2012 02:21:56 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q646LtnI197046 for ; Wed, 4 Jul 2012 02:21:55 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q64BqmLA019360 for ; Wed, 4 Jul 2012 07:52:48 -0400 Received: from kernel.stglabs.ibm.com (kernel.stglabs.ibm.com [9.114.214.19]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q64BqmM4019347; Wed, 4 Jul 2012 07:52:48 -0400 From: John Stultz To: Linux Kernel Cc: John Stultz , Prarit Bhargava , stable@vger.kernel.org, Thomas Gleixner , linux@openhuawei.org Subject: [PATCH 2/3] [RFC] time: Fix leapsecond triggered hrtimer/futex load spike issue Date: Wed, 4 Jul 2012 02:21:29 -0400 Message-Id: <1341382890-42324-3-git-send-email-johnstul@us.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1341382890-42324-1-git-send-email-johnstul@us.ibm.com> References: <1341382890-42324-1-git-send-email-johnstul@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12070406-7408-0000-0000-000006781291 X-Gm-Message-State: ALoCoQkqbCrTcVIjpG2owjXwRLpc4gGZ2LMClXU4NU8DYbsP1iI0tynM5uoJ2w0R2PaUFt8vHS4b 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 CC: linux@openhuawei.org 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);