Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755635AbbLDL4I (ORCPT ); Fri, 4 Dec 2015 06:56:08 -0500 Received: from terminus.zytor.com ([198.137.202.10]:60162 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752458AbbLDL4E (ORCPT ); Fri, 4 Dec 2015 06:56:04 -0500 Date: Fri, 4 Dec 2015 03:55:09 -0800 From: tip-bot for Hiroshi Shimamoto Message-ID: Cc: riel@redhat.com, mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, h-shimamoto@ct.jp.nec.com, lcapitulino@redhat.com, paulmck@linux.vnet.ibm.com, efault@gmx.de, cmetcalf@ezchip.com, fweisbec@gmail.com, torvalds@linux-foundation.org, cl@linux.com, peterz@infradead.org Reply-To: hpa@zytor.com, linux-kernel@vger.kernel.org, h-shimamoto@ct.jp.nec.com, riel@redhat.com, tglx@linutronix.de, mingo@kernel.org, fweisbec@gmail.com, torvalds@linux-foundation.org, cl@linux.com, peterz@infradead.org, lcapitulino@redhat.com, paulmck@linux.vnet.ibm.com, cmetcalf@ezchip.com, efault@gmx.de In-Reply-To: <1447948054-28668-3-git-send-email-fweisbec@gmail.com> References: <1447948054-28668-3-git-send-email-fweisbec@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/cputime: Remove extra cost in task_cputime () Git-Commit-ID: 7877a0ba5ec63c7b0111b06c773f1696fa17b35a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2792 Lines: 77 Commit-ID: 7877a0ba5ec63c7b0111b06c773f1696fa17b35a Gitweb: http://git.kernel.org/tip/7877a0ba5ec63c7b0111b06c773f1696fa17b35a Author: Hiroshi Shimamoto AuthorDate: Thu, 19 Nov 2015 16:47:29 +0100 Committer: Ingo Molnar CommitDate: Fri, 4 Dec 2015 10:34:43 +0100 sched/cputime: Remove extra cost in task_cputime() There is an extra cost in task_cputime() and task_cputime_scaled() when nohz_full is not activated. When vtime accounting is not enabled, we don't need to get deltas of utime and stime under vtime seqlock. This patch removes that cost with adding a shortcut route if vtime accounting is not enabled. Use context_tracking_is_enabled() to check if vtime is accounting on some cpu, in which case only we need to check the tickless cputime delta. Signed-off-by: Hiroshi Shimamoto Signed-off-by: Frederic Weisbecker Signed-off-by: Peter Zijlstra (Intel) Cc: Chris Metcalf Cc: Christoph Lameter Cc: Linus Torvalds Cc: Luiz Capitulino Cc: Mike Galbraith Cc: Paul E . McKenney Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1447948054-28668-3-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar --- kernel/sched/cputime.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 05de80b..1128d4b 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -853,6 +853,14 @@ void task_cputime(struct task_struct *t, cputime_t *utime, cputime_t *stime) { cputime_t udelta, sdelta; + if (!context_tracking_is_enabled()) { + if (utime) + *utime = t->utime; + if (stime) + *stime = t->stime; + return; + } + fetch_task_cputime(t, utime, stime, &t->utime, &t->stime, &udelta, &sdelta); if (utime) @@ -866,6 +874,14 @@ void task_cputime_scaled(struct task_struct *t, { cputime_t udelta, sdelta; + if (!context_tracking_is_enabled()) { + if (utimescaled) + *utimescaled = t->utimescaled; + if (stimescaled) + *stimescaled = t->stimescaled; + return; + } + fetch_task_cputime(t, utimescaled, stimescaled, &t->utimescaled, &t->stimescaled, &udelta, &sdelta); if (utimescaled) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/