lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z5Qm9aXwZhwjBEfy@slm.duckdns.org>
Date: Fri, 24 Jan 2025 13:49:09 -1000
From: Tejun Heo <tj@...nel.org>
To: Abel Wu <wuyun.abel@...edance.com>
Cc: chenridong <chenridong@...wei.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Michal Koutný <mkoutny@...e.com>,
	Jonathan Corbet <corbet@....net>, Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Juri Lelli <juri.lelli@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
	Valentin Schneider <vschneid@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Yury Norov <yury.norov@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Bitao Hu <yaoma@...ux.alibaba.com>,
	"open list:CONTROL GROUP (CGROUP)" <cgroups@...r.kernel.org>,
	"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: Re: [PATCH 1/3] cgroup/rstat: Fix forceidle time in cpu.stat

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@slm.duckdns.org/

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.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ