Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1514615

Re: [PATCH 1/4] sched: move IO scheduling accounting from io_schedule_timeout() to __schedule()

From Pavan Kondeti <pkondeti@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/4] sched: move IO scheduling accounting from io_schedule_timeout() to __schedule()
Date 2016-11-03 16:40 +0100
Message-ID <szshs-5Fc-7@gated-at.bofh.it> (permalink)
References <sxiFA-2q3-15@gated-at.bofh.it> <sxiPg-2Iq-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Tejun,

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 94732d1..f6baa38 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3336,11 +3336,17 @@ static void __sched notrace __schedule(bool preempt)
>         unsigned long *switch_count;
>         struct pin_cookie cookie;
>         struct rq *rq;
> -       int cpu;
> +       int cpu, in_iowait;
>
>         cpu = smp_processor_id();
>         rq = cpu_rq(cpu);
>         prev = rq->curr;
> +       in_iowait = prev->in_iowait;
> +
> +       if (in_iowait) {
> +               delayacct_blkio_start();
> +               atomic_inc(&rq->nr_iowait);
> +       }
>
>         schedule_debug(prev);
>
> @@ -3406,6 +3412,11 @@ static void __sched notrace __schedule(bool preempt)
>         }
>
>         balance_callback(rq);
> +
> +       if (in_iowait) {
> +               atomic_dec(&rq->nr_iowait);
> +               delayacct_blkio_end();
> +       }
>  }

I think, the nr_iowait update can go wrong here.

When the task migrates to a different CPU upon wakeup, this rq points
to a different CPU from the one on which nr_iowait is incremented
before.

Thanks,
Pavan

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHSET RFC] sched, jbd2: mark sleeps on journal->j_checkpoint_mutex as iowait Tejun Heo <tj@kernel.org> - 2016-10-28 19:00 +0200
  [PATCH 2/4] sched: separate out io_schedule_prepare() and io_schedule_finish() Tejun Heo <tj@kernel.org> - 2016-10-28 19:00 +0200
  [PATCH 1/4] sched: move IO scheduling accounting from io_schedule_timeout() to __schedule() Tejun Heo <tj@kernel.org> - 2016-10-28 19:10 +0200
    Re: [PATCH 1/4] sched: move IO scheduling accounting from  io_schedule_timeout() to __schedule() Peter Zijlstra <peterz@infradead.org> - 2016-10-28 20:30 +0200
      Re: [PATCH 1/4] sched: move IO scheduling accounting from  io_schedule_timeout() to __schedule() Peter Zijlstra <peterz@infradead.org> - 2016-10-28 21:10 +0200
        Re: [PATCH 1/4] sched: move IO scheduling accounting from  io_schedule_timeout() to __schedule() Peter Zijlstra <peterz@infradead.org> - 2016-10-29 05:30 +0200
          Re: [PATCH 1/4] sched: move IO scheduling accounting from  io_schedule_timeout() to __schedule() Tejun Heo <tj@kernel.org> - 2016-10-31 17:50 +0100
    Re: [PATCH 1/4] sched: move IO scheduling accounting from  io_schedule_timeout() to __schedule() Pavan Kondeti <pkondeti@codeaurora.org> - 2016-11-03 16:40 +0100
      Re: [PATCH 1/4] sched: move IO scheduling accounting from  io_schedule_timeout() to __schedule() Tejun Heo <tj@kernel.org> - 2016-11-09 00:00 +0100

csiph-web