[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200803151406.59465-1-ning.le@h3c.com>
Date: Mon, 3 Aug 2020 15:14:06 +0000
From: "ning.le" <ning.le@....com>
To: <mingo@...hat.com>, <peterz@...radead.org>,
<juri.lelli@...hat.com>, <vincent.guittot@...aro.org>
CC: <dietmar.eggemann@....com>, <rostedt@...dmis.org>,
<bsegall@...gle.com>, <mgorman@...e.de>,
<linux-kernel@...r.kernel.org>, <he.feng@....com>,
"ning.le" <ning.le@....com>
Subject: [PATCH] sched/cpuacct:Fix previous bugs submitted in history.
Historical submission introduces new issues that When the current cpu
wakes up the thread which works on other cores,the cpuacct module may
add the execution time of thread which on the the other core's rq to
the current core's cpuusage.
Signed-off-by: ning.le <ning.le@....com>
---
kernel/sched/cpuacct.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 941c28cf9738..bd38c9cffdd6 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -341,6 +341,7 @@ void cpuacct_charge(struct task_struct *tsk, u64 cputime)
struct cpuacct *ca;
int index = CPUACCT_STAT_SYSTEM;
struct pt_regs *regs = get_irq_regs() ? : task_pt_regs(tsk);
+ int cpu = task_cpu(tsk);
if (regs && user_mode(regs))
index = CPUACCT_STAT_USER;
@@ -348,8 +349,7 @@ void cpuacct_charge(struct task_struct *tsk, u64 cputime)
rcu_read_lock();
for (ca = task_ca(tsk); ca; ca = parent_ca(ca))
- __this_cpu_add(ca->cpuusage->usages[index], cputime);
-
+ per_cpu_ptr(ca->cpuusage, cpu)->usages[index] += cputime;
rcu_read_unlock();
}
--
2.17.1
-------------------------------------------------------------------------------------------------------------------------------------
本邮件及其附件含有新华三集团的保密信息,仅限于发送给上面地址中列出
的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、
或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
邮件!
This e-mail and its attachments contain confidential information from New H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!
Powered by blists - more mailing lists