Re: Re: Re: [PATCH 1/3] cgroup/rstat: Fix forceidle time in cpu.stat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/25/25 7:49 AM, Tejun Heo Wrote:
On Fri, Jan 24, 2025 at 03:49:16PM +0800, Abel Wu wrote:
...
--- a/kernel/cgroup/rstat.c
+++ b/kernel/cgroup/rstat.c
@@ -613,36 +613,33 @@ static void cgroup_force_idle_show(struct seq_file *seq, struct cgroup_base_stat
   void cgroup_base_stat_cputime_show(struct seq_file *seq)
   {
   	struct cgroup *cgrp = seq_css(seq)->cgroup;
-	u64 usage, utime, stime, ntime;
+	struct cgroup_base_stat bstat;
   	if (cgroup_parent(cgrp)) {
   		cgroup_rstat_flush_hold(cgrp);
-		usage = cgrp->bstat.cputime.sum_exec_runtime;
+		bstat = cgrp->bstat;

Thank you for finding that.
In my version 2, I used to assign cgrp->bstat to bstat.
This is Tj's comment:
https://lore.kernel.org/linux-kernel/ZoQ2ti7nnz9EJSc3@xxxxxxxxxxxxxxx/

I wasn't saying that memcpy() should be used instead of assignment. I was
saying that if a non-trivial struct can be pointed to instead of being
copied, it should be pointed to. If all the fields need to be snapshotted,
assigning is fine.

Thanks for your clarification, Tejun. I will post v2 to address Michal's
comments.

Best Regards,
	Abel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux