From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 3/3] cputime: Consolidate cputime adjustment code
Date: Sun, 25 Nov 2012 14:09:09 -0500 [thread overview]
Message-ID: <20121125190909.GA1866@windriver.com> (raw)
In-Reply-To: <1353680484-7302-4-git-send-email-fweisbec@gmail.com>
[[PATCH 3/3] cputime: Consolidate cputime adjustment code] On 23/11/2012 (Fri 15:21) Frederic Weisbecker wrote:
> task_cputime_adjusted() and thread_group_cputime_adjusted()
> essentially share the same code. They just don't use the same
> source:
>
> * The first function uses the cputime in the task struct and the
> previous adjusted snapshot that ensures monotonicity.
>
> * The second adds the cputime of all tasks in the group and the
> previous adjusted snapshot of the whole group from the signal
> structure.
>
> Just consolidate the common code that does the adjustment. These
> functions just need to fetch the values from the appropriate
> source.
>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> ---
> include/linux/sched.h | 9 +++++++--
> kernel/fork.c | 2 +-
> kernel/sched/cputime.c | 46 +++++++++++++++++++++++-----------------------
> 3 files changed, 31 insertions(+), 26 deletions(-)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index e75cab5..d23204f 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -433,6 +433,11 @@ struct cpu_itimer {
> u32 incr_error;
> };
>
> +struct cputime {
> + cputime_t utime;
> + cputime_t stime;
> +};
> +
Hi Frederic,
This new struct cputime is a 2/3 subset of the three variable struct
task_cputime we see right below. Maybe this is a stupid question, but I
was wondering why you didn't re-use task_cputime, and ignore the
sum_exec_runtime field -- vs. introducing this very similar struct?
Or maybe there is another way to consolidate the structs? With the
two being so similar, I wonder if it will be confusing when to use which
one of the two.
Thanks,
Paul.
--
/**
* struct task_cputime - collected CPU time counts
* @utime: time spent in user mode, in &cputime_t units
* @stime: time spent in kernel mode, in &cputime_t units
* @sum_exec_runtime: total time spent on the CPU, in nanoseconds
*
* This structure groups together three kinds of CPU time that are
* tracked for threads and thread groups. Most things considering
* CPU time want to group these counts together and treat all three
* of them in parallel.
*/
struct task_cputime {
cputime_t utime;
cputime_t stime;
unsigned long long sum_exec_runtime;
};
next prev parent reply other threads:[~2012-11-25 19:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-23 14:21 [PATCH 0/3] cputime: Cleanups on adjusted cputime code Frederic Weisbecker
2012-11-23 14:21 ` [PATCH 1/3] cputime: Move thread_group_cputime() to sched code Frederic Weisbecker
2012-11-23 14:21 ` [PATCH 2/3] cputime: Rename thread_group_times to thread_group_cputime_adjusted Frederic Weisbecker
2012-11-26 18:56 ` Steven Rostedt
2012-11-26 19:24 ` Frederic Weisbecker
2012-11-26 19:33 ` Steven Rostedt
2012-11-27 23:51 ` Frederic Weisbecker
2012-11-28 0:51 ` Steven Rostedt
2012-11-23 14:21 ` [PATCH 3/3] cputime: Consolidate cputime adjustment code Frederic Weisbecker
2012-11-25 19:09 ` Paul Gortmaker [this message]
2012-11-26 0:16 ` Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121125190909.GA1866@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox