From: Peter Zijlstra <peterz@infradead.org>
To: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [patch] sched: fix b5d9d734 blunder in task_new_fair()
Date: Fri, 27 Nov 2009 13:38:42 +0100 [thread overview]
Message-ID: <1259325522.6483.279.camel@laptop> (raw)
In-Reply-To: <1259324499.6483.257.camel@laptop>
On Fri, 2009-11-27 at 13:21 +0100, Peter Zijlstra wrote:
> +static struct rq *
> +balance_task(struct task_struct *p, int sd_flags, int wake_flags)
> +{
> + struct rq *rq, *old_rq;
> + u64 vdelta;
> +
> + rq = old_rq = task_rq(p);
> +
> + if (p->sched_class == &fair_sched_class)
> + vdelta = task_cfs_rq(p)->min_vruntime;
> +
> + __task_rq_unlock(old_rq);
> +
> + cpu = select_task_rq(p, sd_flags, wake_flags);
> +
> + rq = cpu_rq(cpu);
> + spin_lock(&rq->lock);
> + if (rq == old_rq)
> + return rq;
> +
> + update_rq_clock(rq);
> +
> + set_task_cpu_all(p, task_cpu(p), cpu);
> +
> + if (p->sched_class == &fair_sched_class) {
> + vdelta -= task_cfs_rq(p)->min_vruntime;
> + p->se.vruntime -= vdelta;
> }
>
> + return rq;
> +}
Feh, there's a much easier way to deal with that min_vruntime crap.
Do se->vruntime -= cfs_rq->min_vruntime, on dequeue, and
se->vruntime += cfs_rq->min_vruntime, on enqueue
That leaves the whole thing invariant to the cfs_rq when its not
enqueued, and we don't have to fix it up when moving it around.
Also, note that I ripped out the clock_offset thingy, because with the
current sched_clock.c stuff clocks should get synchronized when we do a
remote clock update (or at least appear monotonic).
Getting these two things sorted returns set_task_cpu() to sanity.
/me tosses patch and starts over.
prev parent reply other threads:[~2009-11-27 12:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-22 12:07 [patch] sched: fix b5d9d734 blunder in task_new_fair() Mike Galbraith
2009-11-24 13:51 ` Peter Zijlstra
2009-11-24 17:07 ` Mike Galbraith
2009-11-24 17:35 ` Peter Zijlstra
2009-11-24 17:54 ` Peter Zijlstra
2009-11-24 18:21 ` Mike Galbraith
2009-11-24 18:27 ` Peter Zijlstra
2009-11-24 18:36 ` Mike Galbraith
2009-11-25 6:57 ` Mike Galbraith
2009-11-25 9:51 ` Peter Zijlstra
2009-11-25 13:09 ` Mike Galbraith
2009-11-26 16:26 ` Peter Zijlstra
2009-11-27 8:45 ` Mike Galbraith
2009-11-27 8:57 ` Mike Galbraith
2009-11-27 11:55 ` Mike Galbraith
2009-11-27 12:21 ` Peter Zijlstra
2009-11-27 12:38 ` Peter Zijlstra [this message]
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=1259325522.6483.279.camel@laptop \
--to=peterz@infradead.org \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.