Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753330AbbEHNYF (ORCPT ); Fri, 8 May 2015 09:24:05 -0400 Received: from terminus.zytor.com ([198.137.202.10]:48187 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751340AbbEHNYC (ORCPT ); Fri, 8 May 2015 09:24:02 -0400 Date: Fri, 8 May 2015 06:22:54 -0700 From: tip-bot for Jason Low Message-ID: Cc: Waiman.Long@hp.com, hpa@zytor.com, umgwanakikbuti@gmail.com, dave@stgolabs.net, preeti@linux.vnet.ibm.com, bp@alien8.de, oleg@redhat.com, peterz@infradead.org, tglx@linutronix.de, fweisbec@gmail.com, jason.low2@hp.com, akpm@linux-foundation.org, mingo@kernel.org, paulmck@linux.vnet.ibm.com, mgorman@suse.de, scott.norton@hp.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, riel@redhat.com, rostedt@goodmis.org, aswin@hp.com Reply-To: riel@redhat.com, aswin@hp.com, rostedt@goodmis.org, paulmck@linux.vnet.ibm.com, mgorman@suse.de, scott.norton@hp.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, bp@alien8.de, preeti@linux.vnet.ibm.com, dave@stgolabs.net, peterz@infradead.org, oleg@redhat.com, jason.low2@hp.com, fweisbec@gmail.com, tglx@linutronix.de, mingo@kernel.org, akpm@linux-foundation.org, Waiman.Long@hp.com, hpa@zytor.com, umgwanakikbuti@gmail.com In-Reply-To: <1430251224-5764-5-git-send-email-jason.low2@hp.com> References: <1430251224-5764-5-git-send-email-jason.low2@hp.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched, timer: Provide an atomic ' struct task_cputime' data structure Git-Commit-ID: 971e8a985482c76487edb5a49811e99b96e846e1 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: 2664 Lines: 73 Commit-ID: 971e8a985482c76487edb5a49811e99b96e846e1 Gitweb: http://git.kernel.org/tip/971e8a985482c76487edb5a49811e99b96e846e1 Author: Jason Low AuthorDate: Tue, 28 Apr 2015 13:00:23 -0700 Committer: Ingo Molnar CommitDate: Fri, 8 May 2015 12:17:45 +0200 sched, timer: Provide an atomic 'struct task_cputime' data structure This patch adds an atomic variant of the 'struct task_cputime' data structure, which can be used to store and update task_cputime statistics without needing to do locking. Suggested-by: Ingo Molnar Signed-off-by: Jason Low Signed-off-by: Peter Zijlstra (Intel) Acked-by: Thomas Gleixner Acked-by: Rik van Riel Cc: Andrew Morton Cc: Aswin Chandramouleeswaran Cc: Borislav Petkov Cc: Davidlohr Bueso Cc: Frederic Weisbecker Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Mel Gorman Cc: Mike Galbraith Cc: Oleg Nesterov Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Preeti U Murthy Cc: Scott J Norton Cc: Steven Rostedt Cc: Waiman Long Link: http://lkml.kernel.org/r/1430251224-5764-5-git-send-email-jason.low2@hp.com Signed-off-by: Ingo Molnar --- include/linux/sched.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index a45874c..6eb78cd 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -572,6 +572,23 @@ struct task_cputime { .sum_exec_runtime = 0, \ } +/* + * This is the atomic variant of task_cputime, which can be used for + * storing and updating task_cputime statistics without locking. + */ +struct task_cputime_atomic { + atomic64_t utime; + atomic64_t stime; + atomic64_t sum_exec_runtime; +}; + +#define INIT_CPUTIME_ATOMIC \ + (struct task_cputime_atomic) { \ + .utime = ATOMIC64_INIT(0), \ + .stime = ATOMIC64_INIT(0), \ + .sum_exec_runtime = ATOMIC64_INIT(0), \ + } + #ifdef CONFIG_PREEMPT_COUNT #define PREEMPT_DISABLED (1 + PREEMPT_ENABLED) #else -- 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/