From patchwork Tue Feb 28 00:29:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 6960 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 226AC23E4A for ; Tue, 28 Feb 2012 00:29:54 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id DD1B7A1875A for ; Tue, 28 Feb 2012 00:29:53 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so310163iag.11 for ; Mon, 27 Feb 2012 16:29:53 -0800 (PST) Received: from mr.google.com ([10.50.89.201]) by 10.50.89.201 with SMTP id bq9mr765306igb.55.1330388993745 (num_hops = 1); Mon, 27 Feb 2012 16:29:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.89.201 with SMTP id bq9mr663218igb.55.1330388993686; Mon, 27 Feb 2012 16:29:53 -0800 (PST) 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.11.10 with SMTP id r10csp13070ibr; Mon, 27 Feb 2012 16:29:50 -0800 (PST) Received: by 10.68.236.4 with SMTP id uq4mr1136315pbc.29.1330388990208; Mon, 27 Feb 2012 16:29:50 -0800 (PST) Received: from e34.co.us.ibm.com (e34.co.us.ibm.com. [32.97.110.152]) by mx.google.com with ESMTPS id q7si19276617pbf.267.2012.02.27.16.29.49 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 16:29:50 -0800 (PST) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.152 as permitted sender) client-ip=32.97.110.152; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.152 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 27 Feb 2012 17:29:49 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 27 Feb 2012 17:29:47 -0700 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id ADE003E40036; Mon, 27 Feb 2012 17:29:46 -0700 (MST) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q1S0TjJ1157182; Mon, 27 Feb 2012 17:29:45 -0700 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 q1S0TiZA024812; Mon, 27 Feb 2012 17:29:44 -0700 Received: from kernel.beaverton.ibm.com (kernel.beaverton.ibm.com [9.47.67.96]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q1S0Tix9024778; Mon, 27 Feb 2012 17:29:44 -0700 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id 666EEC03C8; Mon, 27 Feb 2012 16:29:42 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Thomas Gleixner , Eric Dumazet , Richard Cochran Subject: [PATCH 6/7] time: Reduce timekeeper read lock hold time Date: Mon, 27 Feb 2012 16:29:33 -0800 Message-Id: <1330388974-27793-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1330388974-27793-1-git-send-email-john.stultz@linaro.org> References: <1330388974-27793-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12022800-1780-0000-0000-00000385A54A X-IBM-ISS-SpamDetectors: X-IBM-ISS-DetailInfo: BY=3.00000252; HX=3.00000183; KW=3.00000007; PH=3.00000001; SC=3.00000001; SDB=6.00117492; UDB=6.00028615; UTC=2012-02-28 00:29:48 X-Gm-Message-State: ALoCoQmnYxdNFutmEPb09sFul9vYiWvVC99AGxLqWnwIVdqihh+dV8d2H5gsZi3gOqALPtFksOP+ Now that timekeeper updates are done with a shadow copy, we can reduce the readlock hold time to only the update. CC: Thomas Gleixner CC: Eric Dumazet CC: Richard Cochran Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ebfb037..5a444b8 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1062,7 +1062,6 @@ static void update_wall_time(void) s64 remainder; spin_lock_irqsave(&timekeeper.wlock, flags); - write_seqcount_begin(&timekeeper.rlock); /* Make sure we're fully resumed: */ if (unlikely(timekeeping_suspended)) @@ -1145,13 +1144,18 @@ static void update_wall_time(void) second_overflow(); } - + write_seqcount_begin(&timekeeper.rlock); + /* + * We have to store rlock back to tk, otherwise we'll + * corrupt the timeekeerp.rlock when we copy over timekeeper + */ + tk.rlock = timekeeper.rlock; timekeeper = tk; timekeeper.clock->cycle_last = timekeeper.cycle_last; timekeeping_update(&timekeeper, false); + write_seqcount_end(&timekeeper.rlock); out: - write_seqcount_end(&timekeeper.rlock); spin_unlock_irqrestore(&timekeeper.wlock, flags); }