From: Glauber Costa <glommer@parallels.com>
To: linux-kernel@vger.kernel.org
Cc: a.p.zijlstra@chello.nl, Glauber Costa <glommer@parallels.com>
Subject: [PATCH 1/2] Fix user/system tick double accounting
Date: Fri, 2 Dec 2011 19:58:38 -0200 [thread overview]
Message-ID: <1322863119-14225-2-git-send-email-glommer@parallels.com> (raw)
In-Reply-To: <1322863119-14225-1-git-send-email-glommer@parallels.com>
Now that we're pointing cpuacct's root cgroup to cpustat and accounting
through task_group_account_field(), we should not access cpustat directly.
Since it is done anyway inside the acessor function, we end up accounting
it twice, which is wrong.
Signed-off-by: Glauber Costa <glommer@parallels.com>
---
kernel/sched/core.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5181a39..b908df3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2625,8 +2625,6 @@ static inline void task_group_account_field(struct task_struct *p,
void account_user_time(struct task_struct *p, cputime_t cputime,
cputime_t cputime_scaled)
{
- u64 *cpustat = kcpustat_this_cpu->cpustat;
- u64 tmp;
int index;
/* Add user time to process. */
@@ -2634,13 +2632,11 @@ void account_user_time(struct task_struct *p, cputime_t cputime,
p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
account_group_user_time(p, cputime);
- /* Add user time to cpustat. */
- tmp = cputime_to_cputime64(cputime);
-
index = (TASK_NICE(p) > 0) ? CPUTIME_NICE : CPUTIME_USER;
- cpustat[index] += tmp;
+ /* Add user time to cpustat. */
task_group_account_field(p, index, cputime);
+
/* Account for user time used */
acct_update_integrals(p);
}
@@ -2686,16 +2682,12 @@ static inline
void __account_system_time(struct task_struct *p, cputime_t cputime,
cputime_t cputime_scaled, int index)
{
- u64 tmp = cputime_to_cputime64(cputime);
- u64 *cpustat = kcpustat_this_cpu->cpustat;
-
/* Add system time to process. */
p->stime = cputime_add(p->stime, cputime);
p->stimescaled = cputime_add(p->stimescaled, cputime_scaled);
account_group_system_time(p, cputime);
/* Add system time to cpustat. */
- cpustat[index] += tmp;
task_group_account_field(p, index, cputime);
/* Account for system time used */
--
1.7.6.4
next prev parent reply other threads:[~2011-12-02 21:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-02 21:58 [PATCH 0/2] Fix brown paper bag bugs on previous submission Glauber Costa
2011-12-02 21:58 ` Glauber Costa [this message]
2011-12-06 20:21 ` [tip:sched/core] sched/accounting: Fix user/system tick double accounting tip-bot for Glauber Costa
2011-12-02 21:58 ` [PATCH 2/2] fix parameter passing in task_group_account_field Glauber Costa
2011-12-06 20:22 ` [tip:sched/core] sched/accounting: Fix " tip-bot for Glauber Costa
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=1322863119-14225-2-git-send-email-glommer@parallels.com \
--to=glommer@parallels.com \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®