* [PATCH] sched/cpuacct:Fix previous bugs submitted in history.
@ 2020-08-03 15:14 ning.le
0 siblings, 0 replies; only message in thread
From: ning.le @ 2020-08-03 15:14 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot
Cc: dietmar.eggemann, rostedt, bsegall, mgorman, linux-kernel,
he.feng, ning.le
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@h3c.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!
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-03 15:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 15:14 [PATCH] sched/cpuacct:Fix previous bugs submitted in history ning.le
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®