mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Alexey Dobriyan <adobriyan@gmail.com>
Subject: Re: Have we changed /proc/stat idle statistics by NOHZ kernel?
Date: Tue, 2 Aug 2011 19:02:49 +0200	[thread overview]
Message-ID: <20110802170249.GA23698@tiehlicka.suse.cz> (raw)
In-Reply-To: <20110801125916.1855ff3f.akpm@linux-foundation.org>

On Mon 01-08-11 12:59:16, Andrew Morton wrote:
> On Mon, 25 Jul 2011 16:33:13 +0200
> Michal Hocko <mhocko@suse.cz> wrote:
> 
> > Hi,
> > we have a customer reporting that /proc/stat doesn't provide correct
> > results about idle time if the machine is idle.
> > The issue is caused by the fact that tickles kernel doesn't update
> > kstat_cpu(i).cpustat.idle while it is tickles. Tools that parse this
> > file interpret the unchanged value as 0% idle since the last time.
> > While I personally do not think that measuring the idle machine is
> > that important one could say that the semantic of the file has changed
> > with NOHZ which is not good as we are trying to keep this interface
> > stable.
> > One way to fix this is to consider the current status of idle in
> > show_stat. The very primitive attempt of that can be seen bellow (on
> > top of the current Linus tree). I know it has several issue it just
> > illustrates what I am trying to say.  It will not work if jiffies
> > overflow while the CPU was tickles and it also misses locking and
> > handling !NOHZ configuration.
> > 
> > I have also noticed we have get_cpu_idle_time_us which should do
> > something similar. Should it be used instead or it is more intrusive?
> > 
> > Btw. is this considered to be a problem at all?
> > 
> 
> I'd consider it a bug and a regression.  If the machine was idle and
> /proc/stat says "zero idle time" then that is simply incorrect.
> 
> Can we just cheat?  subtract elapsed R and D time from elapsed wall
> time and print that out?

I was thinking about that as well. Something like 
now - (cpustat.user + cpustat.system + cpustat.iowait)

but this has the similar problem because iowait is accounted the same
way as idle.
Or did you mean some other counters?

I am currently looking into using get_cpu_idle_time_us which should be
more convenient but I do not like that it calls update_ts_time_stats
unconditionally (because then we will race with governors which use that
function as well). 

I will try to rip the core out of the function and reuse it here. 
-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

  reply	other threads:[~2011-08-02 17:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-25 14:33 Michal Hocko
2011-08-01 19:59 ` Andrew Morton
2011-08-02 17:02   ` Michal Hocko [this message]
     [not found]     ` <cover.1312544541.git.mhocko@suse.cz>
     [not found]       ` <9314d03604802205b02524ebda1e534547042dfa.1312544541.git.mhocko@suse.cz>
2011-08-05 14:23         ` [PATCH 3/3] proc: consider NO_HZ when printing idle and iowait times Michal Hocko
2011-08-22  9:56           ` [PATCH] nohz: do not update idle/iowait counters from get_cpu_{idle,iowait}_time_us if not asked Michal Hocko
2011-08-17 11:59       ` [PATCH 0/3 RFC] Fix /proc/stat idle/iowait statistics for tickless kernel Michal Hocko
2011-08-23 21:18         ` Andrew Morton
     [not found]       ` <c6c176ace7eca5fffe568865193a1061d181c77c.1312544541.git.mhocko@suse.cz>
2011-08-17 14:02         ` [PATCH 2/3] cputime: clean up cputime_to_usecs and usecs_to_cputime macros Arnd Bergmann

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=20110802170249.GA23698@tiehlicka.suse.cz \
    --to=mhocko@suse.cz \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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®