mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Hua <hucool.lihua@huawei.com>
To: <peterz@infradead.org>
Cc: <bristot@redhat.com>, <bsegall@google.com>,
	<dietmar.eggemann@arm.com>, <hucool.lihua@huawei.com>,
	<juri.lelli@redhat.com>, <linux-kernel@vger.kernel.org>,
	<mgorman@suse.de>, <mingo@redhat.com>, <rostedt@goodmis.org>,
	<stable@vger.kernel.org>, <vincent.guittot@linaro.org>,
	<vschneid@redhat.com>
Subject: Re: [PATCH -next] sched/cputime: Fix the bug of reading time backward from /proc/stat
Date: Wed, 17 Aug 2022 08:44:45 +0800	[thread overview]
Message-ID: <20220817004445.43216-1-hucool.lihua@huawei.com> (raw)
In-Reply-To: <YvoAk1pnU4gZcFJ1@worktop.programming.kicks-ass.net>

It's unreadable, I'm sorry about that.

The CPU statistics time read from /proc/stat should only be incremented. The bug
I found is that the value read latest is smaller than the former.

The root cause of the problem is that the "vtime->utime" and "delta" are temporarily
added to the stack and show to the user. The value of 'vtime->utime + delta' depends
on which task the CPU is executing. As bellow:
show_stat -> kcpustat_cpu_fetch -> kcpustat_cpu_fetch_vtime -> cpustat[CPUTIME_USER] += vtime->utime + delta

  reply	other threads:[~2022-08-16 11:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-13  0:01 Li Hua
2022-08-15  8:15 ` Peter Zijlstra
2022-08-17  0:44   ` Li Hua [this message]
2022-08-29 15:57     ` Li Hua
2022-08-29  5:27       ` Greg KH
2022-09-05  3:47   ` zhengzucheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220817004445.43216-1-hucool.lihua@huawei.com \
    --to=hucool.lihua@huawei.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®