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]
Date:   Fri, 30 Sep 2022 14:16:34 +0200
From:   Frederic Weisbecker <frederic@...nel.org>
To:     zhengzucheng <zhengzucheng@...wei.com>
Cc:     Peter Zijlstra <peterz@...radead.org>, mingo@...hat.com,
        juri.lelli@...hat.com, vincent.guittot@...aro.org,
        dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
        mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
        hucool.lihua@...wei.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] sched/cputime: Fix the time backward issue about
 /proc/stat

On Fri, Sep 30, 2022 at 10:43:58AM +0800, zhengzucheng wrote:
> 
> 在 2022/9/28 20:11, Frederic Weisbecker 写道:
> > @@ -1024,20 +1045,20 @@ static int kcpustat_cpu_fetch_vtime(struct kernel_cpustat *dst,
> >   		 * add pending nohz time to the right place.
> >   		 */
> >   		if (state == VTIME_SYS) {
> > -			cpustat[CPUTIME_SYSTEM] += vtime->stime + delta;
> > +			cpustat[CPUTIME_SYSTEM] += delta;
> >   		} else if (state == VTIME_USER) {
> >   			if (task_nice(tsk) > 0)
> > -				cpustat[CPUTIME_NICE] += vtime->utime + delta;
> > +				cpustat[CPUTIME_NICE] += delta;
> >   			else
> > -				cpustat[CPUTIME_USER] += vtime->utime + delta;
> > +				cpustat[CPUTIME_USER] += delta;
> “delta” has the same problem as vtime->utime, which varies with different
> tasks. switching between different tasks may cause time statistics to be
> reversed.

I'm a bit confused, can you provide an example?

Thanks.

> >   		} else {
> >   			WARN_ON_ONCE(state != VTIME_GUEST);
> >   			if (task_nice(tsk) > 0) {
> > -				cpustat[CPUTIME_GUEST_NICE] += vtime->gtime + delta;
> > -				cpustat[CPUTIME_NICE] += vtime->gtime + delta;
> > +				cpustat[CPUTIME_GUEST_NICE] += delta;
> > +				cpustat[CPUTIME_NICE] += delta;
> >   			} else {
> > -				cpustat[CPUTIME_GUEST] += vtime->gtime + delta;
> > -				cpustat[CPUTIME_USER] += vtime->gtime + delta;
> > +				cpustat[CPUTIME_GUEST] += delta;
> > +				cpustat[CPUTIME_USER] += delta;
> >   			}
> >   		}
> >   	} while (read_seqcount_retry(&vtime->seqcount, seq));
> > .

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ