public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: Preeti Murthy <preeti.lkml@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Fernando Luis Vazquez Cao <fernando_b1@lab.ntt.co.jp>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Oleg Nesterov <oleg@redhat.com>,
	preeti@linux.vnet.ibm.com
Subject: Re: [PATCH 1/2] nohz: use seqlock to avoid race on idle time stats
Date: Mon, 24 Mar 2014 17:21:23 +0900	[thread overview]
Message-ID: <532FEB03.20600@jp.fujitsu.com> (raw)
In-Reply-To: <CAM4v1pPPmiHXNQ19My1Jd8XUQQh+VnbvWwGXq0mVGk4G1vYNfw@mail.gmail.com>

(2014/03/24 16:45), Preeti Murthy wrote:
> Hi Hidetoshi,
> 
> The patch looks good to me except the comments around the monotonicity
> of the return value of the idle stats observer. I am unable to relate them
> to the dependency on nr_iowait_cpu.
> 
> I see that when the reader queries for the idle stats and calls
> get_cpu_idle_time_us(), the nr_iowait_cpu might be 0. When he later
> queries get_cpu_iowait_time_us(), it may be >0 . Hence we will be
> accounting for the idle time in both idle time and iowait time. This
> is definitely a problem. But I do not understand what this has got to
> do with the monotonicity of the time
> returned. This is just for my understanding.

Thank you for your comment!

Ah yes, I think I could write better comments around here to clarify
the monotonicity problem. (It will be happy if someone can give me
such better sentence for here :-D)

One important point is that readers do not update idle stats when they
use these function. i.e.

given:
   idle stats:  idle=1000, iowait=100
   stamp at idle entry: entry=50
   nr tasks waiting io: nr_iowait=1

1st reader:
   query @ now=60
     idle=1000
     iowait=110 (=100+(60-50))

(here nr_iowait changed to 0)

2nd reader:
   query @ now=70
     idle=1020 (=1000+(70-50))
     iowait=100

So you will see iowait is decreased from 110 to 100.

I hope this short story helps you.

Thanks,
H.Seto


  reply	other threads:[~2014-03-24  8:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24  3:05 [PATCH 0/2] nohz: fix idle accounting in NO_HZ kernels Hidetoshi Seto
2014-03-24  3:10 ` [PATCH 1/2] nohz: use seqlock to avoid race on idle time stats Hidetoshi Seto
2014-03-24  7:45   ` Preeti Murthy
2014-03-24  8:21     ` Hidetoshi Seto [this message]
2014-03-25  5:27       ` Preeti U Murthy
2014-03-24  3:10 ` [PATCH 2/2] nohz, procfs: introduce get_cpu_idle/iowait_time_coarse Hidetoshi Seto

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=532FEB03.20600@jp.fujitsu.com \
    --to=seto.hidetoshi@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=fernando_b1@lab.ntt.co.jp \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=peterz@infradead.org \
    --cc=preeti.lkml@gmail.com \
    --cc=preeti@linux.vnet.ibm.com \
    --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