lkml.org 
[lkml]   [2013]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock
On 08/21, Frederic Weisbecker wrote:
>
> On Tue, Aug 20, 2013 at 06:33:12PM +0200, Oleg Nesterov wrote:
> >
> > --- x/kernel/sched/core.c
> > +++ x/kernel/sched/core.c
> > @@ -2435,6 +2435,9 @@ need_resched:
> > rq->curr = next;
> > ++*switch_count;
> >
> > + if (unlikely(prev->in_iowait))
> > + rq->nr_iowait++;
> > +
> > context_switch(rq, prev, next); /* unlocks the rq */
> > /*
> > * The context switch have flipped the stack from under us
> > @@ -2442,6 +2445,12 @@ need_resched:
> > * this task called schedule() in the past. prev == current
> > * is still correct, but it can be moved to another cpu/rq.
> > */
> > + if (unlikely(prev->in_iowait)) {
> > + raw_spin_lock_irq(&rq->lock);
> > + rq->nr_iowait--;
> > + raw_spin_unlock_irq(&rq->lock);
> > + }
> > +
>
> It seems that with this solution rq->nr_iowait is only ever modified locally.
> Can't we just disable irqs for rq->nr_iowait-- ?

Not really. rq holds the old value, which was used when this task
called context_switch() in the past.

IOW, if a task T does io_schedule() on CPU_0, then cpu_of(rq) is still 0
after context_switch(), even if T runs on another cpu.

> Also if this is only updated locally,

Unfortunately, I don't see how we can do this.

Oleg.



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