[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANRm+CzSpr0psdn-ZoMV+S-Bq9s+JRADnnzT81ofwzNnkTqFVQ@mail.gmail.com>
Date: Wed, 22 Feb 2017 17:03:05 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ross Zwisler <zwisler@...il.com>, Mike Galbraith <efault@....de>,
Sachin Sant <sachinp@...ux.vnet.ibm.com>,
Matt Fleming <matt@...eblueprint.co.uk>,
Michael Ellerman <mpe@...erman.id.au>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"linux-next@...r.kernel.org" <linux-next@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [tip:sched/core] sched/core: Add debugging code to catch missing
update_rq_clock() calls
2017-02-02 23:55 GMT+08:00 Peter Zijlstra <peterz@...radead.org>:
> On Tue, Jan 31, 2017 at 10:22:47AM -0700, Ross Zwisler wrote:
>> On Tue, Jan 31, 2017 at 4:48 AM, Mike Galbraith <efault@....de> wrote:
>> > On Tue, 2017-01-31 at 16:30 +0530, Sachin Sant wrote:
>
>
> Could some of you test this? It seems to cure things in my (very)
> limited testing.
>
Tested-by: Wanpeng Li <wanpeng.li@...mail.com>
> ---
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 96e4ccc..b773821 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5609,7 +5609,7 @@ static void migrate_tasks(struct rq *dead_rq)
> {
> struct rq *rq = dead_rq;
> struct task_struct *next, *stop = rq->stop;
> - struct rq_flags rf, old_rf;
> + struct rq_flags rf;
> int dest_cpu;
>
> /*
> @@ -5628,7 +5628,9 @@ static void migrate_tasks(struct rq *dead_rq)
> * class method both need to have an up-to-date
> * value of rq->clock[_task]
> */
> + rq_pin_lock(rq, &rf);
> update_rq_clock(rq);
> + rq_unpin_lock(rq, &rf);
>
> for (;;) {
> /*
> @@ -5641,7 +5643,7 @@ static void migrate_tasks(struct rq *dead_rq)
> /*
> * pick_next_task assumes pinned rq->lock.
> */
> - rq_pin_lock(rq, &rf);
> + rq_repin_lock(rq, &rf);
> next = pick_next_task(rq, &fake_task, &rf);
> BUG_ON(!next);
> next->sched_class->put_prev_task(rq, next);
> @@ -5670,13 +5672,6 @@ static void migrate_tasks(struct rq *dead_rq)
> continue;
> }
>
> - /*
> - * __migrate_task() may return with a different
> - * rq->lock held and a new cookie in 'rf', but we need
> - * to preserve rf::clock_update_flags for 'dead_rq'.
> - */
> - old_rf = rf;
> -
> /* Find suitable destination for @next, with force if needed. */
> dest_cpu = select_fallback_rq(dead_rq->cpu, next);
>
> @@ -5685,7 +5680,6 @@ static void migrate_tasks(struct rq *dead_rq)
> raw_spin_unlock(&rq->lock);
> rq = dead_rq;
> raw_spin_lock(&rq->lock);
> - rf = old_rf;
> }
> raw_spin_unlock(&next->pi_lock);
> }
Powered by blists - more mailing lists