lkml.org 
[lkml]   [2013]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] nohz: Consolidate sleep time stats read code
On Sun, Aug 18, 2013 at 07:00:01PM +0200, Oleg Nesterov wrote:
> On 08/16, Frederic Weisbecker wrote:
> >
> > get_cpu_idle_time_us() and get_cpu_iowait_time_us() mostly share
> > the same code. Lets consolidate both implementations.
>
> Personally I like every patch which consolidates the code ;)
>
> > do {
> > seq = read_seqcount_begin(&ts->sleeptime_seq);
> > - if (ts->idle_active && !nr_iowait_cpu(cpu)) {
> > + if (io)
> > + sleep = ts->iowait_sleeptime;
> > + else
> > + sleep = ts->idle_sleeptime;
> > +
> > + if (ts->idle_active)
> > + continue;
> > +
> > + if ((io && nr_iowait_cpu(cpu)) || (!io && !nr_iowait_cpu(cpu))) {
> > ktime_t delta = ktime_sub(now, ts->idle_entrytime);
> > - idle = ktime_add(ts->idle_sleeptime, delta);
> > - } else {
> > - idle = ts->idle_sleeptime;
> > + sleep = ktime_add(sleep, delta);
> > }
> > } while (read_seqcount_retry(&ts->sleeptime_seq, seq));
>
> Cosmetic/subjective, feel free to ignore. but perhaps
>
> if (ts->idle_active && io == !!nr_iowait_cpu(cpu)) {
> ...
> }
>
> looks more understandable.

Agreed, that's much better.

thanks!

>
> Oleg.
>


\
 
 \ /
  Last update: 2013-08-19 00:01    [W:0.268 / U:1.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site